![]() |
|
|
|||||||
| Home | Forums | Register | Rules & FAQ | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
Other UNIX.COM Threads You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem with dd command or maybe AFS problem | Anta | Shell Programming and Scripting | 0 | 08-25-2006 07:10 AM |
| SSH Problem auth problem | budrito | UNIX for Advanced & Expert Users | 1 | 03-17-2004 06:12 AM |
![]() |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
C++ cin problem
Hi, I have recently started using C++. I use g++ on Unix. I could not get a simple C++ program working.
The program is; #include <iostream> using namespace std; int main() { double a, b; cout << "enter your number"; cin >> a; b = a + 1.15; cout << b << endl; return 0; } when I run this, I get; $enter your number1.15 It does not get 'a' from the user. It assumes that 'a' is zero. Where do I go wrong? |
| Forum Sponsor | ||
|
|
|
|||
|
I pasted your program to run it on Linux g++ and it worked fine.
|
|
|||
|
Quote:
#include <iostream> using namespace std; int main() { double a, b; cout << "enter your number"<<endl; cin >> a; b = a + 1.15; cout << b << endl; return 0; } |