Beginners - January 2012 (Page 7)

While loop not ending.
 
Hello, I have a few problems with a program im making which is supposed to simulate a battle. The user is supposed to enter a command and the program execute it...
[14 replies] Last: you are welcome... you do not need braces for the if statements if ... (by nooblet)
by Pi3
Return 0; Is not Working
 
// conditional operator #include <iostream> using namespace std; int main () { int a,b,c; a=2; b=7; c = (a>b) ? a : b; cout << c; ...
[6 replies] Last: cout << c; cin.get(); // <- return 0; (by Disch)
While loop trouble
 
#include <iostream> #include <stdio.h> #include <string> using namespace std; void PrintMenu(void) { cout <<"+---------Menu---------+" << endl;...
[2 replies] Last: btw, you can only return one variable. u cannot do return var,var1,v... (by nooblet)
The declaration int (*p[5])() means what?
 
int (*p )(); Whats the use of p? Explain with an example or reference.
[1 reply] : With an example. #include <iostream> #include <typeinfo> int main()... (by JLBorges)
"invalid conversion from string to an integer"
 
Here is my delima: while(((menu_choice > f_lines) && (menu_choice < 1)) || (menu_choice == 0)) { cin>> menu_choice; } This piece of code I wrote ...
[1 reply] : Try something like this #include <iostream> #include <string> #includ... (by histrungalot)
Boggle Solver: Finding Prefixes in a Set.
 
This is for a homework assignment, so I don't want the exact code, but would appreciate any ideas that can help point me in the right direction. The assignm...
[2 replies] Last: That's exactly what I needed! Thanks for your help! (by mahuika88)
Why is this printing out twice?
 
Ok so for some reason this outputs the vector twice. Not sure why while(nameFile.good() == true) { getline(nameFile, temp); names.push_back(temp); ...
[5 replies] Last: nameFile.txt vector vector vector EOF 1) nameFile is opened 2) nam... (by vin)
Trying to modify a string >=(
 
string Cipher::key_rotate(string key) { char temp; char replace; int count = 0; for(int i=0;i<key.length();i++) { count++; } cout << count...
[2 replies] Last: Unless your intent is to learn how to implement a rotate algorithm, us... (by JLBorges)
by gbrown
Spacing
 
I am having trouble figuring out how to get a space between my output screen. I may have several lines of output, but would like some of them to have an empty s...
[2 replies] Last: using namespace std; cout<<"\n\n"; cout<<endl<<endl; Both produce th... (by Nexius)
How to fix Errors and change my code. Tips
 
#include <stdio.h> #include <conio.h> int main() { char str ; int cnt ; int i; for (i=0;i<122;++i) cnt =0; clrscr(); printf("Enter a string less than 80...
[1 reply] : [co de] "Please use code tags" [/co de] 1_ If you've got a syntax ... (by ne555)
Graduation Program
 
http://www.cplusplus.com/articles/N6vU7k9E/ So I've been working through this program. Been getting it set up and ready to go all day. I have a file with a bun...
[12 replies] Last: :O Alright cool! Thanks you two. This is probably the most fstream wor... (by ResidentBiscuit)
Problem converting string/char to int using atoi
 
I'm creating a program that solves postfix expressions. I used an algorithm that uses stacks and implements it through vectors. A sample input might look lik...
[2 replies] Last: atoi requires a C-String (i.e. a null character terminated array o... (by shacktar)
by amark
Insertion sort with string array
 
I am trying to sort a list of names using insertion sort. In my insertion sort function at the bottom of my code i am attempting to pass the integer N into my s...
[2 replies] Last: okay thanks (by amark)
Help with my text game?
 
Hi I am writing a adventure game and will soon at classes and things but can you please tell me why I am getting these errors. The intro works but when it says ...
[4 replies] Last: You got lots of other mistakes in the code though once you fix the pre... (by vin)
by Zeph78
Opinion on best way to learn C++
 
So I have been talking with someone who pretty much is a programmer for some company. He told me that I should probably go to some school that teaches C++ or pr...
[4 replies] Last: Thank you everyone for your opinions. Atm I am reading a book "C++ for... (by Zeph78)
I guess I don't understand enums?
 
Ok, so I'm getting some stupid errors. And I'm getting annoyed cause what I thought was straight forward, is now causing my problems. Bunny.h class Bunny { ...
[16 replies] Last: Ah hmm, well thats annoying. I guess I dont need to do that now, I jus... (by ResidentBiscuit)
Loops
 
I'm so lost. The closer I get to the end of the program, the harder it gets. I know this is a terrible mess, but I really need help. I don't know where to st...
[13 replies] Last: Why do I always make things more complicated and retarded than they ar... (by ErinCorona)
How to convert char to int?
 
How can I gather input from a user, say "1 2 3", and put it into an array of int? So far I've tried using cin.getline() and putting the input into an array of t...
[2 replies] Last: if its like "1 2 3" you can use cin and a loop to assign it to variabl... (by kapo)
Linker error: Multiple definition of...
 
I'm having difficulties understanding the following linker error: g++ -g -Wall mycompmain.C complex.C complex.H -o comp /tmp/ccQ5RLlr.o(.text+0x110): In fun...
[3 replies] Last: The file complex.H is indeed included in both complex.C and mycompmain... (by yshicht)
Using rand() to assign enum
 
Ok so I have a couple enums right now, and I need a way to randomly assign one of a few different options to an object. Can I just use rand() to assign this, si...
[2 replies] Last: Great! That worked, thanks :D (by ResidentBiscuit)
January 2012 Pages: 1... 56789... 48
  Archived months: [dec2011] [feb2012]

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