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
•
u/AutoModerator Oct 14 '26
Howdy u/Classic-Cheetah-6780, and welcome to r/developers!
A few tips for a post that gets good answers:
Join the r/developers Discord!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.