Basic C++ Projects
Simple projects to start your C++ programming journey
🚀 Welcome to Basic C++ Projects
Start your C++ journey with simple, practical projects that teach fundamental programming concepts. These beginner-friendly projects will help you understand variables, loops, functions, and basic input/output operations in C++.
#include <iostream>
using namespace std;
int main() {
cout << "Hello, C++ World!" << endl;
return 0;
}
Basic Project Categories
Calculator Programs
Simple arithmetic operations
Basic Calculator
BMI Calculator
Grade Calculator
Simple Games
Interactive console games
Number Guessing
Rock Paper Scissors
Tic Tac Toe
Data Processing
Working with arrays and data
Student Records
Temperature Converter
Simple Statistics
Text Programs
String manipulation projects
Word Counter
Palindrome Checker
Password Generator
🔹 Simple Calculator
A basic calculator that performs arithmetic operations:
#include <iostream>
using namespace std;
int main() {
double num1, num2;
char operation;
cout << "Enter first number: ";
cin >> num1;
cout << "Enter operation (+, -, *, /): ";
cin >> operation;
cout << "Enter second number: ";
cin >> num2;
switch(operation) {
case '+':
cout << "Result: " << num1 + num2 << endl;
break;
case '-':
cout << "Result: " << num1 - num2 << endl;
break;
case '*':
cout << "Result: " << num1 * num2 << endl;
break;
case '/':
if(num2 != 0)
cout << "Result: " << num1 / num2 << endl;
else
cout << "Error: Division by zero!" << endl;
break;
default:
cout << "Invalid operation!" << endl;
}
return 0;
}
Sample Output:
Enter first number: 10
Enter operation (+, -, *, /): +
Enter second number: 5
Result: 15
🔹 Number Guessing Game
A fun game where the computer picks a random number:
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
srand(time(0)); // Seed random number generator
int secretNumber = rand() % 100 + 1; // Random number 1-100
int guess;
int attempts = 0;
cout << "Welcome to the Number Guessing Game!" << endl;
cout << "I'm thinking of a number between 1 and 100." << endl;
do {
cout << "Enter your guess: ";
cin >> guess;
attempts++;
if (guess > secretNumber) {
cout << "Too high! Try again." << endl;
} else if (guess < secretNumber) {
cout << "Too low! Try again." << endl;
} else {
cout << "Congratulations! You guessed it in "
<< attempts << " attempts!" << endl;
}
} while (guess != secretNumber);
return 0;
}
🔹 Student Grade Manager
Store and calculate student grades:
#include <iostream>
#include <string>
using namespace std;
int main() {
string studentName;
int numSubjects;
double totalMarks = 0;
cout << "Enter student name: ";
getline(cin, studentName);
cout << "Enter number of subjects: ";
cin >> numSubjects;
for(int i = 1; i <= numSubjects; i++) {
double marks;
cout << "Enter marks for subject " << i << ": ";
cin >> marks;
totalMarks += marks;
}
double average = totalMarks / numSubjects;
cout << "\n--- Student Report ---" << endl;
cout << "Name: " << studentName << endl;
cout << "Total Marks: " << totalMarks << endl;
cout << "Average: " << average << endl;
if(average >= 90) cout << "Grade: A+" << endl;
else if(average >= 80) cout << "Grade: A" << endl;
else if(average >= 70) cout << "Grade: B" << endl;
else if(average >= 60) cout << "Grade: C" << endl;
else cout << "Grade: F" << endl;
return 0;
}