Beginners - May 2020 (Page 12)

Quick help with ifstream (reading data from file)
 
Hey guys, I have .txt with data in it : 2 3 0 128 0 255 0 0 255 255 255 255 255 0 255 0 0 255 255 0...
[2 replies] Last: If your RGB data is encoded as 3 numbers to each line I'd probably cre... (by deleted account xyzzy)
Pass class method to object
 
Can I somehow pass class method to aggregated object? I want to run one method inside Hero object t...
[5 replies] Last: i've got displaySomeText() const; which i want to use in two differen... (by dhayden)
Filling a cstring array with text from a text file
 
Hello all, I wanted to try out the cstrings and decided to use them with File I/O in c++. I want to ...
[12 replies] Last: #include <fstream> #include <iostream> using namespace std; int mai... (by againtry)
Removing an element from an array
 
I have .txt with this data : 5 Z 14 R 12 G 20 R 5 R 6 my goal is to add same letters into one tota...
[1 reply] : Use a std::map to accumulate similar values. (by lastchance)
Help with switch-case statements
 
Hello, I'm working on this problem for my C++ class. The question is to write a program that does th...
[8 replies] Last: @Handy Andy, you are right. It was in a previous post and I missed it. (by Thomas1965)
by Nitsou
I get the error : [Error] expected primary-expression before 'int' for line 17
 
#include <iostream> using namespace std; int subtract(int a, int b){ return a-b; } int main(...
[2 replies] Last: hahaha my bad! (by Nitsou)
by vysero
Undefined reference
 
I am getting an error when I try to use the method in this header file: undefined reference to ...
[3 replies] Last: @dutch Yes that's exactly what it was. I needed to include the lib in ... (by vysero)
Returning To A Menu
 
Hi, so I have a program which adds objects to a Linked List after selecting an option from a menu. L...
[4 replies] Last: Can you at least give more detail about Menu? What do you mean by "ano... (by dutch)
Text file and string array
 
I have a text file which actually is a book and I have to store 1000 random words to a string array....
[4 replies] Last: @dhayden, for step 2, "select 1000 numbers from 1 to N", you want that... (by dutch)
Bool remove from array by value
 
Was recently tasked with removing all instances of a value from an array with a boolean function. I ...
[3 replies] Last: Yes, it can be improved. Instead of copying the entire remaining array... (by dhayden)
Forward declarations of classes, invalid use
 
Hello, I was given an assignment to write a program which demonstrates the usage of classes. ...
[2 replies] Last: Thank you very much! It worked. (by arczi w)
by hbcpp
Iterating a file
 
I have a school assignment where I have to work with memory allocation. I have to iterate a file an...
[4 replies] Last: Actually, apparently as of C++11, you don't need the file.clear() fir... (by hbcpp)
Create smart calculator.
 
Hello, I need to create smart calculator. For example, i need to find Sum of 7 and "three", compi...
[5 replies] Last: double a = get_number(); double b = get_number(); char operation ... (by lastchance)
by defs
polymorphism
 
Hi, this this a part of my code, so i have a problem with "virtual double Add()=0;" function, if i d...
[4 replies] Last: When you want to instantiate an object of a derived class from an abst... (by nuderobmonkey)
How to use a loop to fill an array
 
My prompt is: 1. Prompt the user and input a variable named array_size.2. Dynamically allocate an ar...
[3 replies] Last: Another little "oops"..... line 16 is not using your array. array_va... (by deleted account xyzzy)
Issues with using a vector
 
Hello, I am writing a program for a contact manager and I am using istream for inputting data. I nee...
[4 replies] Last: [quote name=theforgottenone4] Thanks for your reply! Unfortunately, th... (by TheIdeasMan)
Most efficient control condition in a loop (1,2,3)
 
There was a multiple choice question on a quiz that asked the following: The most efficient contr...
[42 replies] Last: You keep arguing the point, why should int be more efficient? In the ... (by TheToaster)
Sorting problems
 
Hey guys, I came across little bit more complicated sorting function. I have results : Merginos (...
[2 replies] Last: are you asking how to do a then-by sort? it works like you would do it... (by jonnin)
Program that uses classes and member functions...
 
Hi, So I wrote a program that uses a class named "LinearEquation" to calculate X and Y the two line...
[6 replies] Last: Ok I understand, that worked I appreciate the help. (by Dustin792)
by asxxx
Conversion of objects
 
Hi, I am trying to convert type of class object, please about some tips. #include <iostream> usi...
[1 reply] : What exactly do you mean by “convert”? Do you mean like cast? Ther... (by highwayman)
May 2020 Pages: 1... 1011121314... 17
  Archived months: [apr2020] [jun2020]

This is an archived page. To post a new message, go to the current page.