| | |
Program runs but not visible
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2006
Posts: 179
Reputation:
Solved Threads: 2
Hi all
I am totally new to C++ and I am using the Dev C++ compiler and getting the tutorial off
http://www.cplusplus.com/doc/tutoria...structure.html
I ran the first program (code below) and it compiled fine but when I run it a box appears then dissappears so quickly I dont have time to see what it is but by the black colour I assume its DOS, can anyone tell me why it is doing this please as I don't know if my program is working correctly and I tried the other examples and the same happens, am I doing something wrong is that why it dissappears so quickly?
Many thanks
HLA91
I am totally new to C++ and I am using the Dev C++ compiler and getting the tutorial off
http://www.cplusplus.com/doc/tutoria...structure.html
I ran the first program (code below) and it compiled fine but when I run it a box appears then dissappears so quickly I dont have time to see what it is but by the black colour I assume its DOS, can anyone tell me why it is doing this please as I don't know if my program is working correctly and I tried the other examples and the same happens, am I doing something wrong is that why it dissappears so quickly?
C++ Syntax (Toggle Plain Text)
/ my first program in C++ #include <iostream> using namespace std; int main () { cout << "Hello World!"; return 0; }
Many thanks
HLA91
You know your a geek, if you introduce your wife as "mylady@home.wife"
> why didnt the tutorial tell me that
Because it ain't got nowt to do with c++, or the semantics of the language anyway. It depends on whether your IDE (integrated development environment) already has a built-in option to pause the program for viewing.
Some don't, some do.
If you ran your program from the command prompt there would be no need for the
>a good tutorial for me
There are a few useful snippets at daniweb. Look there. But ultimately the best way to learn is to try your hand at a problem and post your queries here.
Because it ain't got nowt to do with c++, or the semantics of the language anyway. It depends on whether your IDE (integrated development environment) already has a built-in option to pause the program for viewing.
Some don't, some do.
If you ran your program from the command prompt there would be no need for the
cin.get();.>a good tutorial for me
There are a few useful snippets at daniweb. Look there. But ultimately the best way to learn is to try your hand at a problem and post your queries here.
Last edited by iamthwee; Oct 7th, 2007 at 3:31 pm.
*Voted best profile in the world*
•
•
Join Date: Oct 2006
Posts: 179
Reputation:
Solved Threads: 2
I have come across another problem again, the code from another tutorial wont be visible
I did try placing cin.get(); before the closing bracket but that didn't work and I also added return 0; incase that helped but nope. Also I cant execute the programs on my laptop running windows Me when I type IF.exe when im in the folder it says syntax error is there something different with the DOS? Many thanks HLA91
C++ Syntax (Toggle Plain Text)
// How IF Works#include <iostream>using namespace std;int main(){ cout << "Enter your age: "; int age; cin >> age; if (age < 20) cout << "You are still young!\n"; else cout << "You are not so young anymore.\n"; }
You know your a geek, if you introduce your wife as "mylady@home.wife"
•
•
Join Date: Oct 2006
Posts: 179
Reputation:
Solved Threads: 2
What do you mean I dont know how to format my code, if you mean placing it in my post I obviously can becasue I did it in the first post of this topic all you did was comress it which to me makes it harder to read. Also I wont be handing it to my instructor becasue this is a hobby not a school subject.
You know your a geek, if you introduce your wife as "mylady@home.wife"
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
Join Date: Oct 2007
Posts: 8
Reputation:
Solved Threads: 2
Because I'm such a sweet guy:
But to help you I guess we will nead a bit more info, the code should execute properly as it is. The problem of 'not visible', is it still in the ide?
C++ Syntax (Toggle Plain Text)
// How IF Works #include <iostream> using namespace std; int main(){ cout << "Enter your age: "; int age; cin >> age; if (age < 20) cout << "You are still young!\n"; else cout << "You are not so young anymore.\n"; return 0; //Yes I did put in 'return 0' because it's bad //practice to leave it out and yada yada yada... }
But to help you I guess we will nead a bit more info, the code should execute properly as it is. The problem of 'not visible', is it still in the ide?
![]() |
Similar Threads
- Jumps into code on program end (Pascal and Delphi)
- run program and rename file script help please (Shell Scripting)
- How to make my program detecct when the computer is going to LOGOFF or SHUTDOWN (C)
- DOS program created with Clipper error out in Windows 2000 (Windows NT / 2000 / XP)
- VB6 submit button sends information to BBChat (Visual Basic 4 / 5 / 6)
- My Program runs but not correctly (C++)
- need help on corporate sales program (C++)
- Problem trying to run old fortran based program in win xp (Windows NT / 2000 / XP)
- Program runs in an infinite loop (C++)
- Getting an Older Program to Run on Windows XP (Windows tips 'n' tweaks)
Other Threads in the C++ Forum
- Previous Thread: cin.get() & cin.ignore()?!
- Next Thread: Determin the average of an array that generates 30 random numbers.
| Thread Tools | Search this Thread |
api array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






Explain why it's a bad practice, please. 