From f09e57c35adb41e118c2481e77b5b8c9f312057a Mon Sep 17 00:00:00 2001 From: damodar-d Date: Sat, 9 Aug 2025 11:21:50 +0530 Subject: [PATCH 1/8] Initial Commit --- Pokemon/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pokemon/main.cpp b/Pokemon/main.cpp index c2bc7bfc..31a7bb06 100644 --- a/Pokemon/main.cpp +++ b/Pokemon/main.cpp @@ -1,6 +1,6 @@ #include +using namespace std; int main() { - return 0; } From d9e9effeef00a10eb7e8551358769207538ec64e Mon Sep 17 00:00:00 2001 From: damodar-d Date: Sat, 9 Aug 2025 11:23:44 +0530 Subject: [PATCH 2/8] added main code --- Pokemon/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Pokemon/main.cpp b/Pokemon/main.cpp index 31a7bb06..1387f3ea 100644 --- a/Pokemon/main.cpp +++ b/Pokemon/main.cpp @@ -2,5 +2,12 @@ using namespace std; int main() { + string playerName; + + cout << "Enter your name: "; + cin >> playerName; + cout << "Great Start " << playerName << ", looks like you have understood the main() function properly now!" << endl; + + return 0; } From bdff471d801c486a156ed2405565cfe50740189e Mon Sep 17 00:00:00 2001 From: damodar-d Date: Sat, 9 Aug 2025 13:20:01 +0530 Subject: [PATCH 3/8] added choice code --- Pokemon/main.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/Pokemon/main.cpp b/Pokemon/main.cpp index 31a7bb06..89fc6c0d 100644 --- a/Pokemon/main.cpp +++ b/Pokemon/main.cpp @@ -1,6 +1,34 @@ #include +#include using namespace std; -int main() { +int main() +{ -} + string playerName; + + cout << "Enter your name: "; + cin >> playerName; + + cout << "Great Start " << playerName << ", looks like you have understood the main() function properly now!" << endl; + + cout << "Welcome to the world of Pokémon! I am Professor Oak.\n"; + cout << "You can choose one of the following Pokémon:\n"; + cout << "1. Bulbasaur\n2. Charmander\n3. Squirtle\n"; + cout << "Which Pokémon would you like to choose? Enter the number: "; + + int choice; + cin >> choice; + + if(choice == 1) { + cout << "You have chosen Bulbasaur! A grass-type Pokémon." << endl; + } else if(choice == 2) { + cout << "You have chosen Charmander! A fire-type Pokémon." << endl; + } else if(choice == 3) { + cout << "You have chosen Squirtle! A water-type Pokémon." << endl; + } else { + cout << "Invalid choice. Please restart the game and choose a valid Pokémon." << endl; + } + + return 0; +} \ No newline at end of file From 13e642589e578f113ba0b76f3d5fc91375f41ec9 Mon Sep 17 00:00:00 2001 From: damodar-d Date: Sat, 9 Aug 2025 20:41:19 +0530 Subject: [PATCH 4/8] Profrssors message added --- Pokemon/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Pokemon/main.cpp b/Pokemon/main.cpp index a6bd1522..1a3a704b 100644 --- a/Pokemon/main.cpp +++ b/Pokemon/main.cpp @@ -30,5 +30,12 @@ int main() cout << "Invalid choice. Please restart the game and choose a valid Pokémon." << endl; } + cout<<"Ah, an excellent choice!\n"; + cout<<"But beware, Trainer,\n"; + cout<<"this is only the beginning.\n"; + cout<<"Your journey is about to unfold.\n"; + cout<<"Now let’s see if you’ve got what it takes to keep going!\n"; + cout<<"Good luck, and remember… Choose wisely!\n"; + return 0; } From 0799be8014c02fd7953c88ad36a233fd57985278 Mon Sep 17 00:00:00 2001 From: damodar-d Date: Sat, 9 Aug 2025 20:51:47 +0530 Subject: [PATCH 5/8] converted if-else ladder to switch case --- Pokemon/main.cpp | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/Pokemon/main.cpp b/Pokemon/main.cpp index 1a3a704b..d39e9dc2 100644 --- a/Pokemon/main.cpp +++ b/Pokemon/main.cpp @@ -18,24 +18,33 @@ int main() cout << "Which Pokémon would you like to choose? Enter the number: "; int choice; - cin >> choice; + cin >> choice; - if(choice == 1) { + switch (choice) + { + case 1: cout << "You have chosen Bulbasaur! A grass-type Pokémon." << endl; - } else if(choice == 2) { + break; + + case 2: cout << "You have chosen Charmander! A fire-type Pokémon." << endl; - } else if(choice == 3) { + break; + + case 3: cout << "You have chosen Squirtle! A water-type Pokémon." << endl; - } else { + break; + + default: cout << "Invalid choice. Please restart the game and choose a valid Pokémon." << endl; + break; } - cout<<"Ah, an excellent choice!\n"; - cout<<"But beware, Trainer,\n"; - cout<<"this is only the beginning.\n"; - cout<<"Your journey is about to unfold.\n"; - cout<<"Now let’s see if you’ve got what it takes to keep going!\n"; - cout<<"Good luck, and remember… Choose wisely!\n"; + cout << "Ah, an excellent choice!\n"; + cout << "But beware, Trainer,\n"; + cout << "this is only the beginning.\n"; + cout << "Your journey is about to unfold.\n"; + cout << "Now let’s see if you’ve got what it takes to keep going!\n"; + cout << "Good luck, and remember… Choose wisely!\n"; return 0; } From 734dd5126725db6ad3506b7a7352a1bab25c8953 Mon Sep 17 00:00:00 2001 From: damodar-d Date: Sat, 9 Aug 2025 20:58:32 +0530 Subject: [PATCH 6/8] The Switch Challenge --- Pokemon/main.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/Pokemon/main.cpp b/Pokemon/main.cpp index d39e9dc2..f0f9b5d7 100644 --- a/Pokemon/main.cpp +++ b/Pokemon/main.cpp @@ -6,31 +6,46 @@ int main() { string playerName; + string chosenPokemon = ""; + cout << "Professor Oak: Hello there! Welcome to the world of Pokemon!\n"; + cout << "Professor Oak: My name is Oak. People call me the Pokemon " + "Professor!\n"; + cout << "Professor Oak: But enough on me. Let's talk about you!\n"; + + cout << "Professor Oak: First, tell me, what’s your name?\n"; cout << "Enter your name: "; cin >> playerName; - cout << "Great Start " << playerName << ", looks like you have understood the main() function properly now!" << endl; + cout << "Professor Oak: Ah, " << playerName + << "! What a fantastic name!\n"; + cout << "Professor Oak: You must be eager to start your adventure. But " + "first, you’ll need a Pokemon of your own!\n"; - cout << "Welcome to the world of Pokémon! I am Professor Oak.\n"; + cout << "Professor Oak: For now, I have three Pokémon for you to choose from.\n"; cout << "You can choose one of the following Pokémon:\n"; cout << "1. Bulbasaur\n2. Charmander\n3. Squirtle\n"; cout << "Which Pokémon would you like to choose? Enter the number: "; int choice; + cout << "Professor Oak: So, which one will it be? Enter the number of " + "your choice: "; cin >> choice; switch (choice) { case 1: + chosenPokemon = "Bulbasaur"; cout << "You have chosen Bulbasaur! A grass-type Pokémon." << endl; break; case 2: + chosenPokemon = "Charmander"; cout << "You have chosen Charmander! A fire-type Pokémon." << endl; break; case 3: + chosenPokemon = "Squirtle"; cout << "You have chosen Squirtle! A water-type Pokémon." << endl; break; @@ -38,8 +53,14 @@ int main() cout << "Invalid choice. Please restart the game and choose a valid Pokémon." << endl; break; } - cout << "Ah, an excellent choice!\n"; + + cout << "Professor Oak: " << chosenPokemon << " and you, " + << playerName << ", are going to be the best of friends!\n"; + + cout << "Professor Oak: Your journey begins now! Get ready to explore " + "the vast world of Pokemon!\n"; + cout << "But beware, Trainer,\n"; cout << "this is only the beginning.\n"; cout << "Your journey is about to unfold.\n"; From d05ea19127bf206bb907db6e547dc67c95544b15 Mon Sep 17 00:00:00 2001 From: damodar-d Date: Sat, 9 Aug 2025 21:37:43 +0530 Subject: [PATCH 7/8] Added enum logic --- Pokemon/main.cpp | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/Pokemon/main.cpp b/Pokemon/main.cpp index f0f9b5d7..c1e261bc 100644 --- a/Pokemon/main.cpp +++ b/Pokemon/main.cpp @@ -2,30 +2,42 @@ #include using namespace std; +enum PokemonChoice +{ + BULBASAUR = 1, + CHARMANDER, + SQUIRTLE, + INVALID +}; + +void seperate() +{ + cout << "----------------------------------------\n"; +} + int main() { string playerName; - string chosenPokemon = ""; + PokemonChoice chosenPokemon = INVALID; cout << "Professor Oak: Hello there! Welcome to the world of Pokemon!\n"; cout << "Professor Oak: My name is Oak. People call me the Pokemon " "Professor!\n"; cout << "Professor Oak: But enough on me. Let's talk about you!\n"; - + seperate(); cout << "Professor Oak: First, tell me, what’s your name?\n"; cout << "Enter your name: "; cin >> playerName; - cout << "Professor Oak: Ah, " << playerName + cout << "\n\nProfessor Oak: Ah, " << playerName << "! What a fantastic name!\n"; cout << "Professor Oak: You must be eager to start your adventure. But " "first, you’ll need a Pokemon of your own!\n"; - + seperate(); cout << "Professor Oak: For now, I have three Pokémon for you to choose from.\n"; cout << "You can choose one of the following Pokémon:\n"; cout << "1. Bulbasaur\n2. Charmander\n3. Squirtle\n"; - cout << "Which Pokémon would you like to choose? Enter the number: "; int choice; cout << "Professor Oak: So, which one will it be? Enter the number of " @@ -35,29 +47,31 @@ int main() switch (choice) { case 1: - chosenPokemon = "Bulbasaur"; + chosenPokemon = BULBASAUR; cout << "You have chosen Bulbasaur! A grass-type Pokémon." << endl; break; case 2: - chosenPokemon = "Charmander"; + chosenPokemon = CHARMANDER; cout << "You have chosen Charmander! A fire-type Pokémon." << endl; break; case 3: - chosenPokemon = "Squirtle"; + chosenPokemon = SQUIRTLE; cout << "You have chosen Squirtle! A water-type Pokémon." << endl; break; default: - cout << "Invalid choice. Please restart the game and choose a valid Pokémon." << endl; + chosenPokemon = CHARMANDER; + cout << "Hmm... You made an invalid choice. Anyways, I am assigning you Charmrander as your Pokemon friend.\n" + << endl; break; } - cout << "Ah, an excellent choice!\n"; + cout << "Ah, an excellent choice!\n\n"; - cout << "Professor Oak: " << chosenPokemon << " and you, " + cout << "Professor Oak: " << (chosenPokemon == BULBASAUR ? "Balbasaur" : chosenPokemon == CHARMANDER ? "Charmander": "Squirtle")<< " and you, " << playerName << ", are going to be the best of friends!\n"; - + seperate(); cout << "Professor Oak: Your journey begins now! Get ready to explore " "the vast world of Pokemon!\n"; From 23307addbe13c2a426dfd368ffbb8e34c1ec0136 Mon Sep 17 00:00:00 2001 From: damodar-d Date: Sat, 9 Aug 2025 21:43:32 +0530 Subject: [PATCH 8/8] added PokemonType enum --- Pokemon/main.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Pokemon/main.cpp b/Pokemon/main.cpp index c1e261bc..8aaf161a 100644 --- a/Pokemon/main.cpp +++ b/Pokemon/main.cpp @@ -2,7 +2,7 @@ #include using namespace std; -enum PokemonChoice +enum class PokemonChoice { BULBASAUR = 1, CHARMANDER, @@ -10,6 +10,15 @@ enum PokemonChoice INVALID }; +enum class PokemonType +{ + FIRE, + ELECTRIC, + WATER, + EARTH, + NORMAL, +}; + void seperate() { cout << "----------------------------------------\n"; @@ -19,7 +28,7 @@ int main() { string playerName; - PokemonChoice chosenPokemon = INVALID; + PokemonChoice chosenPokemon = PokemonChoice::INVALID; cout << "Professor Oak: Hello there! Welcome to the world of Pokemon!\n"; cout << "Professor Oak: My name is Oak. People call me the Pokemon " @@ -47,29 +56,31 @@ int main() switch (choice) { case 1: - chosenPokemon = BULBASAUR; + chosenPokemon = PokemonChoice::BULBASAUR; cout << "You have chosen Bulbasaur! A grass-type Pokémon." << endl; break; case 2: - chosenPokemon = CHARMANDER; + chosenPokemon = PokemonChoice::CHARMANDER; cout << "You have chosen Charmander! A fire-type Pokémon." << endl; break; case 3: - chosenPokemon = SQUIRTLE; + chosenPokemon = PokemonChoice::SQUIRTLE; cout << "You have chosen Squirtle! A water-type Pokémon." << endl; break; default: - chosenPokemon = CHARMANDER; + chosenPokemon = PokemonChoice::CHARMANDER; cout << "Hmm... You made an invalid choice. Anyways, I am assigning you Charmrander as your Pokemon friend.\n" << endl; break; } cout << "Ah, an excellent choice!\n\n"; - cout << "Professor Oak: " << (chosenPokemon == BULBASAUR ? "Balbasaur" : chosenPokemon == CHARMANDER ? "Charmander": "Squirtle")<< " and you, " + cout << "Professor Oak: " << (chosenPokemon == PokemonChoice::BULBASAUR ? "Balbasaur" : chosenPokemon == PokemonChoice::CHARMANDER ? "Charmander" + : "Squirtle") + << " and you, " << playerName << ", are going to be the best of friends!\n"; seperate(); cout << "Professor Oak: Your journey begins now! Get ready to explore "