can someone tell me how to get the out put in c++, like after making something in c++ how can i see wat i made. i am new to c++ and still learning so can u help me plz.
help with c++
Started by
sabeeh
, Dec 18 2005 03:15 PM
8 replies to this topic
#1
Posted 18 December 2005 - 03:15 PM
#2
Posted 18 December 2005 - 03:27 PM
If I've understood you right, you want to show something on the screen, don't you?
First of all, include this line just after the includes at the top of the program:
Then, in your program, if you want to show a message, just use:
And if you want to show the value of some variable, for example:
Hope it helps
First of all, include this line just after the includes at the top of the program:
using namespace std;
Then, in your program, if you want to show a message, just use:
cout << "This message will appear on the screen";
And if you want to show the value of some variable, for example:
int tutorials = 5;Your program here...
cout << "The number of tutorials is: " << tutorials;It'll show: The number of tutorials is: 5
Hope it helps
#3
Posted 18 December 2005 - 03:38 PM
even after typing this how do i see the output screen that i need to know?
#4
Posted 18 December 2005 - 03:59 PM
You should compile the program using a compilator.
I use Dev-C++, it's free.
Save your program as example.cpp for example, and then compile it using a compilator.
If the program is correct, an *.exe file will appear where you've saved the *.cpp one.
To execute the program, just open the *.exe file
I use Dev-C++, it's free.
Save your program as example.cpp for example, and then compile it using a compilator.
If the program is correct, an *.exe file will appear where you've saved the *.cpp one.
To execute the program, just open the *.exe file
Edited by PSgirl, 18 December 2005 - 04:27 PM.
#5
Posted 18 December 2005 - 04:23 PM
thank you varrrrrrrrryyyyyyy much it works now
#6
Posted 19 December 2005 - 04:38 AM
Thougth I´d add something, ´cause when I compile only text, the window pops up and closes immidiately, before i even can see what the output is. So, at the end of my code, I simply insert:
Then the program waits for user to press a key before it shuts down.
system("pause");
Then the program waits for user to press a key before it shuts down.
#7
Posted 19 December 2005 - 06:01 AM
Yes, that happens sometimes.
You can also use
You can also use
cin.get(); cin.get()at the end of your code, so the window remains open until you press a key two times.
#8
Posted 19 December 2005 - 11:38 AM
And you can also use :
#include <iostream.h> #include <conio.h> int main() { cout<<"Text"<<endl; getch(); return 0; }
#9
Posted 19 December 2005 - 02:00 PM
Yes, lots of possibilities there
I'm closing this topic as the original question has been answered.
sabeeh feel free to start another topic if you have any other issues with C++
I'm closing this topic as the original question has been answered.
sabeeh feel free to start another topic if you have any other issues with C++
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users