Jump to content
Sign in to follow this  
Archerzz

Need A Program Challenge

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

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

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

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

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×