[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: function call misinterpreted as a variable
From: |
Thomas Maeder |
Subject: |
Re: function call misinterpreted as a variable |
Date: |
Mon, 03 Oct 2005 19:44:37 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) |
sjbrown8@eng.usf.edu writes:
> int main()
> {
> double xpos;
> double a;
> double b;
> double c;
> double square;
> double xneg;
>
> cout << "This program will compute a quadratic equation\n";
> cout << "Please enter a number: \n";
> cin >> a;
> cout << "Please enter another number: \n";
> cin >> b;
> cout << "Please enter a final number: \n";
> cin >> c;
>
> square = quad(a,b,c);
Side note:
This is very unsafe code. If one of the input operations fails,
reading its value causes the program to have undefined behavior. A
program should always first check for success of an input operation
before using the value (apparently) read.