1.

Solve : Stupid Noob in C++ be me, help me out??

Answer»

I am new to C++ having switched over from batch. I am trying to make a number counter to, but dont seem to be having much luck. Every time i try to compile it says i have an EXPRESSION syntax error. Dont give me a new program, just tell me what is wrong with mine.

#include

using namespace std;

int main()
{
int tminus;

cout&LT;< "Please ENTER number to count to";
cin>> tminus;
cin.ignore();
for ( int x = 0; x <= << tminus <<; x++ ) {
cout<< x < }
cin.get();
}

thanks in advance.
Again, please dont harass couse its something obvious. Im new okay? Quote from: dirt1996 on March 01, 2009, 06:12:01 PM

the loop:
Code: [Select] for ( int x = 0; x >= tminus ; x++ ) {
cout<< x <<endl;
}


too many << operators... I would guess you picked those up from batch lol thank you so much! Quote from: BC_Programmer on March 01, 2009, 09:37:28 PM
Quote from: dirt1996 on March 01, 2009, 06:12:01 PM
the loop:
Code: [Select] for ( int x = 0; x >= tminus ; x++ ) {
cout<< x <<endl;
}


too many << operators... I would guess you picked those up from batch lol
but how do i fix this? Code: [Select]count << x << endl;
Can you put it in the code for me. So the loop part isnt necessary is what ur saying? Again I am so sorry for being DIFFICULT that would just be the one line- I believe the reason it isn't working is the lack of spaces

Even with that one line I typo'd


Code: [Select]#include <IOSTREAM>

using namespace std;

int main(int argc, char* argv[])
{
int tminus;

cout << "Please enter number to count to:";
cin >> tminus;
cin.ignore();
for ( int x = 0; x <= tminus ; x++ ) {
cout << x <<endl;
}
cin.get();
}

that code compiles and runs with Microsoft Visual C++ 6.Sorry for being stupid, thank you so much!


Discussion

No Comment Found