Skip to content

Instantly share code, notes, and snippets.

@levlaz
Created August 23, 2015 22:53
Show Gist options
  • Save levlaz/3eccda48ebaa01b02a92 to your computer and use it in GitHub Desktop.
Save levlaz/3eccda48ebaa01b02a92 to your computer and use it in GitHub Desktop.
#include <iostream>
int main()
{
// << is an output operator that prints the message to STDOUT
// Writing endl to std ends the current line and flushes the buffer
// Prefix std:: referes to the std namespace and is used to avoid
// collision.
std::cout << "Enter two numners:" << std::endl;
int v1 = 0, v2 = 0;
// >> is an input operator that reads from the STDIN
std::cin >> v1 >> v2;
std::cout << "The sum of " << v1 << " and " << v2
<< " is " << v1 + v2 << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment