mirror of
https://github.com/VictorEijkhout/TheArtOfHPC_vol3_cppf08programming.git
synced 2026-01-24 22:44:48 +09:00
26 lines
658 B
C++
26 lines
658 B
C++
/****************************************************************
|
|
****
|
|
**** This file belongs with the course
|
|
**** Introduction to Scientific Programming in C++/Fortran2003
|
|
**** copyright 2016 Victor Eijkhout eijkhout@tacc.utexas.edu
|
|
****
|
|
**** cindo.cxx : test cin terminating condition
|
|
****
|
|
****************************************************************/
|
|
|
|
#include <cmath>
|
|
using std::sqrt;
|
|
|
|
#include <iostream>
|
|
using std::cin, std::cout;
|
|
|
|
int main() {
|
|
float var;
|
|
// VLE I was hoping that null would abort, but only illegal does
|
|
while ( (bool)(cin >> var) ) {
|
|
cout << "Root of " << var << " is " << sqrt(var) << '\n';
|
|
}
|
|
return 0;
|
|
}
|
|
|