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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...