mirror of
https://github.com/VictorEijkhout/TheArtOfHPC_vol3_cppf08programming.git
synced 2026-01-24 22:44:48 +09:00
30 lines
656 B
C++
30 lines
656 B
C++
/****************************************************************
|
|
****
|
|
**** This file belongs with the course
|
|
**** Introduction to Scientific Programming in C++/Fortran2003
|
|
**** copyright 2018-2021 Victor Eijkhout eijkhout@tacc.utexas.edu
|
|
****
|
|
**** ref.cxx : using references, not as parameter
|
|
****
|
|
****************************************************************/
|
|
|
|
#include <iostream>
|
|
using std::cin;
|
|
using std::cout;
|
|
|
|
int main() {
|
|
|
|
//codesnippet refint
|
|
int i;
|
|
int &ri = i;
|
|
i = 5;
|
|
cout << i << "," << ri << '\n';
|
|
i *= 2;
|
|
cout << i << "," << ri << '\n';
|
|
ri -= 3;
|
|
cout << i << "," << ri << '\n';
|
|
//codesnippet end
|
|
|
|
return 0;
|
|
}
|