Advertisement
KingAesthetic

Example 2 for C++

May 20th, 2024
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.72 KB | Source Code | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main() {
  5.     // Code that loops through an array of sports:
  6.     string Sports[2][4] = {
  7.             {"football", "basketball", "lawn tennis", "Table tennis"},
  8.             {"ice hockey", "badminton","Swimming", "bull riding"}
  9.     };
  10.     for (int i = 0; i < 2; i++) {
  11.         for (int j = 0; j < 4; j++) {
  12.             cout << Sports[i][j]  << "\n";
  13.         }
  14.     }
  15.  
  16.     // Code that prints my name: "President Emmanuel":
  17.     int (name);
  18.     switch (7) {
  19.         case 1:
  20.             cout << "Ethanol";
  21.             break;
  22.         case 2:
  23.             cout << "Solocord";
  24.             break;
  25.         case 3:
  26.             cout << "Pixie";
  27.             break;
  28.         case 4:
  29.             cout << "Kevin";
  30.             break;
  31.         case 5:
  32.             cout << "Sir Von Cawingthon";
  33.             break;
  34.         case 6:
  35.             cout << "Dav";
  36.             break;
  37.         case 7:
  38.             cout << "President Emmanuel";
  39.             break;
  40.         case 8:
  41.             cout << "arcxion";
  42.             break;
  43.         case 9:
  44.             cout << "Jabit";
  45.             break;
  46.         case 10:
  47.             cout << "deepforce";
  48.             break;
  49.     }
  50.  
  51.     // Code that finds the division of two numbers << "\n";
  52.     int x,y;
  53.     int division;
  54.     cout << "Type a number: " << "\n";
  55.     cin >> x;
  56.     cout << "Type another number: " << "\n";
  57.     cin >> y;
  58.     division = x / y;
  59.     cout << division << "\n";
  60.  
  61. // Code that asks you for your football club and prints it out:
  62.     string club;
  63.     string result;
  64.     cout << "What is your football club: " << "\n";
  65.     cin >> club;
  66.     cout << "This is your club: " << club << "\n";
  67.     cin >> result;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement