![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Programming A discussion forum for programs and programming used in tech-related businesses. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Jun 2009
Posts: 2
OS: Vista Service Pack 1
|
A problem with C++ program
I have a bit of a problem with my C++-programs. I get them to work and all that but when I want them to display an end result it goes wrong. It's not that it doesn't work it's just that the program closes itself before i get to view the result. Basicly i cant get the program to pause before closing down.
---------------------------------------------------- Ex // convert.cpp #include <iostream> double stonetokg(double); int main() ** using namespace std; double stone; cout << "Input weight in stone:"; cin >> stone; double kilo = stonetokg(stone); cout << stone << " stone is "; cout << kilo << " kilogram." << endl; cin.get(); return 0; } double stonetokg(double sts) ** return 6,35 * sts; } ---------------------------------------------------- Don't know if it's a problem caused by vista or not. Last edited by At4ri; 06-13-2009 at 12:04 PM. |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,880
OS: Vista, various linux distros
|
Re: A problem with C++ program
Edit: re-read your code. How are you executing the program?(from an IDE? just through windows? command prompt?)...
Re-Edit: Found the problem: Code:
cin >> stone; Change it to: Code:
cin >> stone; cin.ignore();//ignores the enter and takes the users input Jamey Last edited by jamiemac2005; 06-13-2009 at 01:44 PM. |
|
|
|
![]() |
| Thread Tools | |
|
|