diff options
author | Oskar <[email protected]> | 2024-07-28 12:52:38 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-07-28 12:52:38 +0200 |
commit | 5aac3c3f8bcfef0b2aad28d91d87b9ebf1d5e7df (patch) | |
tree | 38736b9f0c57f69e272121e0fc1f3969bb7468e2 /sum.cpp |
first commit
Diffstat (limited to 'sum.cpp')
-rw-r--r-- | sum.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ +#include <iostream> + +/* + * Sum program in C++ + * + * Mainly to learn about cin and cout + * + * Also learned a bit about << and >> + * + * + */ + +int main (void) { + + int num1 = 0; + int num2 = 0; + std::cout << "Enter two numbers please" << std::endl; // We send text to 'cout' a so called 'ostream' + std::cin >> num1 >> num2; // here we read test from 'cin' a so called 'istream'. We put the first input in num1 and 2nd input in num2 + std::cout << "num1: " << num1 // 'cout' same thing here, and these can be multiline which can be nice + << " num2: " << num2 + << "\nYour sum is: damn " << num1+num2 + << "\nYour product is: damn " << num1*num2 << std::endl; + + return 0; +} |