mirror of
https://github.com/VictorEijkhout/TheArtOfHPC_vol3_cppf08programming.git
synced 2026-01-24 22:44:48 +09:00
29 lines
699 B
C++
29 lines
699 B
C++
/****************************************************************
|
|
****
|
|
**** This file belongs with the course
|
|
**** Introduction to Scientific Programming in C++/Fortran2003
|
|
**** copyright 2017-9 Victor Eijkhout eijkhout@tacc.utexas.edu
|
|
****
|
|
**** twicein.cxx : simple function illustration
|
|
****
|
|
****************************************************************/
|
|
|
|
#include <iostream>
|
|
using std::cout;
|
|
|
|
//examplesnippet twicein
|
|
int double_this(int n) {
|
|
int twice_the_input = 2*n;
|
|
return twice_the_input;
|
|
}
|
|
//examplesnippet end
|
|
|
|
int main() {
|
|
//examplesnippet twicein
|
|
int number = 3;
|
|
cout << "Twice three is: "
|
|
<< double_this(number) << '\n';
|
|
//examplesnippet end
|
|
return 0;
|
|
}
|