Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Loop problems!

This topic is 5123 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So, I finally got past the closing issue. I found out the #include <conio.h> command, which lets me use the getch() command before i return 0. Anyway, so I did some of the programs in a few lessons off of www.cprogramming.com and i'm on the loops lesson. Now, I'll type in the given program and you tell me whats wrong, because it won't let me run the program at all. Even after I compile it, i get a warning that says its not compiled. What am I doing wrong??
#include <iostream.h>
int main()
 {
  for(int x=0;x<100;x++)
  {

     cout << x << end1;
  }
  return 0;
} 
I'm a newbie, so don't yell at me if thats what its sposed to do. Thanks in advance! If you can find me, you will recieve $1,000,000,000 in cash!! [Edit: Use space liberally. And you can edit your own posts. -Oluseyi] [edited by - Oluseyi on May 9, 2004 2:57:30 PM]

Share this post


Link to post
Share on other sites
Advertisement
HOLY POOP!
cout <;<; x <;<; end 1;
imagine that without all the ; except for the one at the end, and all of it squished together!
STUPID THINGY!


If you can find me, you will recieve $1,000,000,000 in cash!!

Share this post


Link to post
Share on other sites
You could first read the FAQ to get the source right (tip: source tags).
btw: do you get any error messages?
What compiler do you use (VC 7.1 won'accept iostream.h anymore).
And it's endl, not end1 (last letter is a L).


[edited by - VolkerG on May 9, 2004 2:54:20 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by DudeManGuy
HOLY POOP!
cout <;<; x <;<; end 1;
imagine that without all the ; except for the one at the end, and all of it squished together!
As I pointed out in your original posts (I removed the others), you can edit your posts. The forum software accepts HTML, so it views "<x" as the beginning of an HTML tag, which is why the rest of the line disappears.

It''s more readable to have a space in between every token (variable identifier, operator, etc) anyway:
#include <iostream>
using namespace std;

 
int main()
{
for( int x = 0; x < 100; ++x )
{
cout << x << endl;
}
return 0;
}
The lines in bold are different from yours. The header <iostream.h> is old and non-standard, so you shouldn''t use it. Use <iostream> (no ".h" extension) instead. The latter places all symbols inside the namespace std. Explaining namespaces in full is tedious, and has been done before. Google or search this site for "C++ namespace".

Share this post


Link to post
Share on other sites
quote:
Original post by EQRainer
I thought it was ENDL, not END1...
It is (lowercase, though, and a monotype ''l'' can look like a ''1'': l, 1). What leads you to this question?

Share this post


Link to post
Share on other sites
Hehehe, thanks so much, I''ll try it right now

Sorry bout the code thing, I had no idea that it operated that way. Thanks again, and next time I''ll be sure to put it in with spaces.

If you can find me, you will recieve $1,000,000,000 in cash!!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!