Beginners - July 2015 (Page 18)

Should I use getters and setters, or just use a constructor?
 
In the code below, I have a (set of) getters and a (set of) setters. Above my getters and setters I have a constructor that does (from my understanding) the exa...
[1 reply] : Constructors are used so that an object is (in most cases) in a usable... (by Ganado)
Doesn't read cin inside while loop
 
How can I make it so that the user enters the name for each sibling? right now it just displays: How many brothers and sisters do you have?4 A big family! W...
[3 replies] Last: Changing it into a string worked, thanks!!! (by nanor00)
by cnj3
Print a string in reverse order using cout
 
I am stuck on one part of an assignment. Among other things, we have to get a character string of random length from a user and then reverse and output that str...
[4 replies] Last: Yes! I got it! I was making it way too complicated. Thank you both so... (by cnj3)
C2. Functions with variable number of arguments
 
Write a function write with variable number of arguments that takes a string first argument followed by any number of arguments of type double and prints on th...
[no replies]
Text Parsing Error
 
The code below is giving me problems. What am I doing wrong and how do I fix it? #include <iostream> #include <string> #include <vector> /* Parse a strin...
[1 reply] : The second parameter to substr: http://www.cplusplus.com/reference/str... (by keskiverto)
Animate issue
 
Do any of you know where to put system("cls") in my code so that the system doesn't keep printing another board, and I just keep the same board. Thanks. ...
[no replies]
Why can a char * be assigned to a string?
 
Sorry for the poor wording. This would make more sense. char * Greeting = "Hello World!"; // This works You normally cannot assign values to pointers....
[6 replies] Last: Okay, fixed. It'll still cause abnormal termination, and shouldn't be ... (by Duthomhas)
Char to ASCII value program
 
Why does not the following program work? What am I doing wrong here. Can someone please help me out? // you can use includes, for example: #include <algorithm...
[3 replies] Last: I think I figured it out. I should have done if(48<=letter && letter<... (by funprogrammer)
input user his/her grade
 
Im a newbie to this .. im having a hard time to solve whats the problem, #include <iostream> #include <string> using namespace std; int main () { ...
[1 reply] : What you probably want is to make display an array. Also, never tes... (by kbw)
Animation and Warning not error for value return question
 
I know its long, but I wanted you to see where the functions are being called and how. I get a warning that says not all control paths return a value for check ...
[5 replies] Last: What I mean by that is, I want all the moves to continue to be shown, ... (by holy9ner)
Does this program look effective?
 
I am trying to develop an Address Book program, and I am wanting to do it the correct way. I feel most things are correct. I am using getters and setters here, ...
[5 replies] Last: Rep around here is gained and lost through arguments in the Lounge. Do... (by booradley60)
Searching for a string
 
If I want to read in a file and search each line for a certain string and then output every line that contains that string to a new file what is the best way to...
[1 reply] : Open input file Open output file Read line from input file Compare to ... (by MiiNiPaa)
Another Plinko program problem - error when input is not a number
 
I'm writing a Plinko game program and have pretty much finished everything, but there's one error that I can't fix. When option 2 or 3 (multiple chips in one sl...
[1 reply] : Fixed it. I was just missing a cin.fail code in a necessary spot. (by brachburton1)
by Kew
How to convert data type int to char?
 
I would like to convert a data type int to char. For example, i would like to convert int a = 100 into char a = '1', a ='0' , a ='0'. i had tried itoa ...
[4 replies] Last: Look like i have a long way to go.... there are a lot of function and ... (by Kew)
SFML - Statically Linking Libraries (1,2)
 
I've been struggling to get SFML set up using the statically linked libraries for the past couple of hours. I'm using Code::Blocks, and at the moment I have ...
[22 replies] Last: I can't find any more information on deleting user made templates so i... (by Bogeyman)
Calculator program mode input problem.
 
Why won't this variable work as a mode control in a calculator program. The result is the console asking for a mode input indefinitely. #include <iostre...
[4 replies] Last: Ah, that would explain it, I tried using "m" but that threw up some er... (by A Space Ostrich)
Trouble with searching for strings in code
 
Im working on a code that asks the user to enter a line of text and a word they would like the code to count the number of occurrences for. However, say if I in...
[4 replies] Last: Thanks so much my program finally works. (by jgreenwo13)
by Enot02
An error
 
I've wrote a code which converts denary number in another scale of notation. Here is the code: //---------------------------------------------------------...
[18 replies] Last: Oh no, I need hex symbols. How to attach them? (by Enot02)
Program compiles but crashes
 
solved
[2 replies] Last: Actually, line 29 needs to be as it is -- while(last->link != NULL)... (by andywestken)
Use of cin to enter value pairs into STL map
 
How do you write a function that reads value pairs from cin and places them in map msi? // C21Drill Map.cpp #include <iostream> #include <map> #include <str...
[10 replies] Last: Thank you very much, JLBorges. (by phztfte1)
July 2015 Pages: 1... 1617181920... 33
  Archived months: [jun2015] [aug2015]

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