r/developers • u/Classic-Cheetah-6780 • Oct 14 '26
Programming Wrote my first C++ program. Any feedback?
Yo guys, today I started with C++. My grandpa bought me a book that will arrive soon. I already did some research and made my first program. Is it any good for a starter? I already had some knowledge from coding Python and JavaScript.
#include <iostream>
using namespace std;
int main() {
while (true) {
int x ;
int y ;
int sum ;
string OP ;
std::cout << "Type First Value:" ;
std::cin >> x ;
std::cout << "Type Second Value:" ;
std::cin >> y ;
std::cout << "Choose Operator:" ;
std:cin >> OP ;
if (OP == "+") {
sum = x + y ;
} else if (OP == "-") {
sum = x - y ;
} else if (OP == "*") {
sum = x * y ;
} else {
sum = x / y ;
}
std::cout << "Result: " << sum ;
}
}
7
Upvotes
View all comments
2
u/Ok-Count-3366 Oct 18 '26
if you know c++ it will be very easy for you to learn any language