Jump to content

Need A Program Challenge


Archerzz

Recommended Posts

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? :rolleyes:

 

Start = 7

Stop = 2

Start = 7 - 2 = 5

Stop = 2

Start still > Stop

 

:)

Share this post


Link to post
Share on other sites

  • Replies 60
  • Created
  • Last Reply

Top Posters In This Topic

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 :P

 

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

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]

 

:lol:

 

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

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

:lol:, you'll get there eventually.

 

Suprisingly I couldn't tell you if that was right or not :O 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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...