![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
It would wait for you to type an input before the window closed.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
|
|
#12 |
|
Hobbyist Programmer
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5
![]() |
__________________
Personal Portfolio TecBrain Support Forum Linux VS Windows ... Dont Even Think of it .. Distribution: Slackware if (OS==Linux) return success There are 10 kinds of people, those who can read binary numbers and those who can't. |
|
|
|
|
|
#13 |
|
Programmer
Join Date: Sep 2004
Location: JHB , South Africa
Posts: 79
Rep Power: 5
![]() |
this works for me:
#include <iostream>
using namespace std;
int main()
{
float a,b;
cout << "Enter degrees celcius: ";
cin >> a;
cout << "Degrees Fahernheit: " << (a*1.8) + 32 << endl;
system("PAUSE");
return 0;
}
__________________
Ravilj's OpenGL Terrain aka WinTerrain Last Updated: 17/01/2005! |
|
|
|
|
|
#14 |
|
Hobbyist Programmer
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5
![]() |
yah, that works for me too.
Can i ask what is the system("PAUSE"); for.
__________________
Personal Portfolio TecBrain Support Forum Linux VS Windows ... Dont Even Think of it .. Distribution: Slackware if (OS==Linux) return success There are 10 kinds of people, those who can read binary numbers and those who can't. |
|
|
|
|
|
#15 |
|
Newbie
|
Whatever you write in the system() parentheses is echoed as if it was typed in a DOS command prompt, so what it would do is issue the "PAUSE" command, which effectively stops it from doing whatever it's doing and displays the message
"Press any key to continue . . ." |
|
|
|
|
|
#16 |
|
Programmer
Join Date: Sep 2004
Location: JHB , South Africa
Posts: 79
Rep Power: 5
![]() |
TecBrain, try this quick remove the system("PAUSE") and run it and see what happens, just out of interest...
__________________
Ravilj's OpenGL Terrain aka WinTerrain Last Updated: 17/01/2005! |
|
|
|
|
|
#17 |
|
Hobbyist Programmer
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5
![]() |
That’s why I asked, because when I moved out the:
system("PAUSE");The output did not appear, as soon as I entered the input the Dos screen goes away. So I was wondering if that code would be allowing the output to appear. Thanks in all cases guys, you were helpful. I will be asking allot of question as the time passes. :unsure:
__________________
Personal Portfolio TecBrain Support Forum Linux VS Windows ... Dont Even Think of it .. Distribution: Slackware if (OS==Linux) return success There are 10 kinds of people, those who can read binary numbers and those who can't. |
|
|
|
|
|
#18 |
|
Programmer
Join Date: Sep 2004
Location: JHB , South Africa
Posts: 79
Rep Power: 5
![]() |
interesting... yeah than just use that at the end of all your windows console programs to see the output.
Ok I downloaded Dev C compiler, when you select a new console application it sets out the followign code by default: #include <iostream>
#include <stdlib.h>
using namespace std;
int main(int argc, char *argv[])
{
system("PAUSE");
return 0;
}So it seems that Visual Studio adds that in for you and with dev c its left up to you to add it in.
__________________
Ravilj's OpenGL Terrain aka WinTerrain Last Updated: 17/01/2005! |
|
|
|
|
|
#19 |
|
Expert Programmer
Join Date: Sep 2004
Location: Ontario, Canada
Posts: 556
Rep Power: 5
![]() |
Here's my Celsius to Fahrenheit converter written in C
#include<stdio.h>
main()
{
float c,f;
printf("Celsius to Fahrenheit\n\n\n");
printf("Enter Celsius value: ");
scanf("%f",&c);
f=(1.8*c)+32;
printf("\n%.0f C = %.0f F\n", c,f);
return 0;
}
__________________
Johnny was a chemist's son but Johnny is no more, for what Johnny thought was H2O was H2SO4 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|