C++ Examples: Basic Operations and Code Snippets
C++ Code Examples
Basic Output
#include <iostream>
using namespace std;
int main(){
cout << "Hola a todos!" << endl;
}
Sum of Two Integers
#include <iostream>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
cout << x + y << endl;
}
Sum of Three Integers
#include <iostream>
using namespace std;
int main() {
int x, y, z;
cin >> x >> y >> z;
cout << x + y + z << endl;
}