Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

C++ Question

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 pigsfl3w   Members   

122
Like
Likes
Like

Posted 29 January 2002 - 06:14 PM

I am trying to get numbers from the command line as arguments. Just to try it out I did something like: int main(int argc, char* argv[]) { int a = (int) argv[1]; int b = (int) argv[2]; int c = a + b; //etc... } Only problem is, this didn''t work. Any suggestions how to do this? The usage is something like ''program . Thank You, pigsfl3w

#2 Martee   Members   

476
Like
Likes
Like

Posted 29 January 2002 - 06:16 PM

Try this ...
int a = atoi(argv[1]);
int b = atoi(argv[2]);
int c = a + b;


#3 pigsfl3w   Members   

122
Like
Likes
Like

Posted 29 January 2002 - 06:20 PM

What header file is atoi() in?

#4 Anonymous Poster_Anonymous Poster_*   Guests   

Likes

Posted 29 January 2002 - 06:25 PM

#include <stdio.h>




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.