markiemrboo Posted July 12, 2005 Posted July 12, 2005 Or, you could do something such as: if(start >/*=*/ stop) { start = start - stop } EDIT: And isn't the string variable just a friendly wrapper around a char array? 507916[/snapback] What's that gonna do to help? Start = 7 Stop = 2 Start = 7 - 2 = 5 Stop = 2 Start still > Stop Share this post Link to post Share on other sites More sharing options...
Archerzz Posted July 12, 2005 Posted July 12, 2005 Kool thanks for your help and I figured out that I needed a main function so I changed that and also that my loop was infinate when it kept giving me 4 over and over and over <_< . Here is what my finished product looks like. #include <iostream> using namespace std; int main() { int start, stop, count, i; cout << "Where do you want to start? "; cin >> start; cout << "Where do you want to stop? "; cin >> stop; cout << "What do you want to count by? "; cin >> count; for (i = start; i <= stop; i += count) { cout << i << endl; } return 0; } Thanks for all your help. I could use some more ideas now I think I will try the tic-tac-toe one. So keep checking in here cause I can tell you now I'm going to need help.... Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 12, 2005 Posted July 12, 2005 tic-tac-toe will be an interesting one Wouldn't that need some sort of basic AI type effort? Ut oh Or you could just make the computer pick a random spot lol yey for randomness!!! Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted July 12, 2005 Posted July 12, 2005 dang, I didn't spot that soon enough. I'll use the fact that I was tired! *gets back to reading about WinSocks* Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 12, 2005 Posted July 12, 2005 dang, I didn't spot that soon enough. I'll use the fact that I was tired!*gets back to reading about WinSocks* 507982[/snapback] I'm sitting on ebay waiting for the amplifier I want to end. Then I will have to read about Smelly Socks too Maybe we could make some sort of amazing OCC chat.... which would crash every few minutes... and we could blame it on everyones overclock being unstable *one handed clapping contest begins ....NOW* Share this post Link to post Share on other sites More sharing options...
Archerzz Posted July 12, 2005 Posted July 12, 2005 ok i give up i dont like strings they are different than java or im just dumb.. I think I will go with the second one Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 12, 2005 Posted July 12, 2005 lol, I love char arrays Share this post Link to post Share on other sites More sharing options...
Archerzz Posted July 12, 2005 Posted July 12, 2005 what would it look like if I just wanted it to hold X and O for me ? i have char xando[] = {"X", "O"}; would that be right or not (prolly not). Ok decied to put that one aside for when I can actully write a program withough friggin erros Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 12, 2005 Posted July 12, 2005 , you'll get there eventually. Suprisingly I couldn't tell you if that was right or not Been a while since I used a char array like that. *opens dev-cpp* Nearly... char *xando[] = {"X", "O"}; If you wanted to do it the way you've done it, without the confusing looking pointer then replace the "s with a ' like: char xando[] = {'X', 'O'}; Share this post Link to post Share on other sites More sharing options...
Archerzz Posted July 12, 2005 Posted July 12, 2005 how do i declare strings? Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 12, 2005 Posted July 12, 2005 char *moo = "Moo Moo Moo"; or string moo2 = "Moo Moo Moo"; Share this post Link to post Share on other sites More sharing options...
Archerzz Posted July 12, 2005 Posted July 12, 2005 ok if i had this string string moo = "Hello World" if i wanted to print that i would type cout << moo; right? Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now