cpp: added cpp folder and io example
This commit is contained in:
parent
7ea30b14d1
commit
4dabc47832
27
cpp/io/io.cpp
Normal file
27
cpp/io/io.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include<iostream>
|
||||||
|
|
||||||
|
//use cout and cin to print some stuff and get input
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
/*
|
||||||
|
* All of these "<<" are going into std::cout
|
||||||
|
* the "endl" forces a flush
|
||||||
|
* note that is "l" as in "line" not "1" as in "one"
|
||||||
|
*/
|
||||||
|
std::cout << "Enter two numbers: "<< std::endl;
|
||||||
|
|
||||||
|
int input_1;
|
||||||
|
int input_2;
|
||||||
|
input_1 = 0;
|
||||||
|
input_2 = 0;
|
||||||
|
|
||||||
|
std::cin >> input_1 >> input_2;
|
||||||
|
|
||||||
|
std::cout << "The numbers "
|
||||||
|
<< input_1
|
||||||
|
<< " and "
|
||||||
|
<< input_2
|
||||||
|
<< " add together to make "
|
||||||
|
<< input_1 + input_2
|
||||||
|
<< std::endl;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user