Jump to content
  • Advertisement
Sign in to follow this  
Inuyashakagome16

hey i have another question.

This topic is 4811 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

K. I use Dev C++ for my IDE and it has a compiler with it. and it works. (yea!) Now The problem when i Compiler then Run when the window comes up after i click run with the program running. if i hit enter it shuts the window. that's bad because some of the programs im making require me to enter a number and letter and press enter. how do i fix this?

Share this post


Link to post
Share on other sites
Advertisement
ok it kinda worked but didnt it lets me hit enter but doesnt run the program the way it supose to play. here's the code:

#include <stdio.h>

int mult ( int x, int y );

int main()
{
int x;
int y;

printf( "Please input two numbers to be multiplied: " );
scanf( "%d", &x );
scanf( "%d", &y );
printf( "The product of your two numbers is %d\n", mult( x, y ) );
getchar();
}

int mult (int x, int y)
{
return x * y;

}

Share this post


Link to post
Share on other sites
I created a Dev-C++ C project and added a source file with this:

#include<stdio.h>

int main(void) {

int x,y;

printf("Please input two numbers to be multiplied: ");
scanf("%d %d", &x, &y);
printf("The product of your two input numbers is %d\n", mult(x,y));
system("PAUSE");

}

int mult (int x, int y) {
return x * y;
}

and it worked fine. (I recoded it, so most of your code should be fine, like the seprate scanf lines).

Share this post


Link to post
Share on other sites
thx it worked :-).
something i dont get is that the place i got the code from is:
http://www.cprogramming.com/tutorial.html#ctutorial
and this place is supose to teach me how to write code and all the code i get from them dont work.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!