mirror of
https://github.com/VictorEijkhout/TheArtOfHPC_vol3_cppf08programming.git
synced 2026-01-24 22:44:48 +09:00
29 lines
646 B
C++
29 lines
646 B
C++
/****************************************************************
|
|
****
|
|
**** This file belongs with the course
|
|
**** Introduction to Scientific Programming in C++/Fortran2003
|
|
**** copyright 2019-2021 Victor Eijkhout eijkhout@tacc.utexas.edu
|
|
****
|
|
**** ifinit.cxx : conditionals with init part
|
|
****
|
|
****************************************************************/
|
|
|
|
#include <iostream>
|
|
using std::cout;
|
|
#include <cstdio>
|
|
|
|
int main() {
|
|
|
|
//codesnippet ifinitchar
|
|
if ( char c = getchar(); c!='a' )
|
|
cout << "Not an a, but: " << c
|
|
<< '\n';
|
|
else
|
|
cout << "That was an a!"
|
|
<< '\n';
|
|
//codesnippet end
|
|
|
|
return 0;
|
|
}
|
|
|