Skip to content

Instantly share code, notes, and snippets.

@shnitish
Created April 28, 2021 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shnitish/6264524a11074f3b235e6d6511949c1f to your computer and use it in GitHub Desktop.
Save shnitish/6264524a11074f3b235e6d6511949c1f to your computer and use it in GitHub Desktop.
Guess birth date program
#include <iostream>
#include <vector>
using namespace std;
void display(vector<vector<int>> &card)
{
for(int i = 0; i < card.size(); i++)
{
for(int j = 0; j < card[0].size(); j++)
{
cout << card[i][j] << " ";
}
cout << "\n";
}
cout << endl;
}
int main()
{
// initializing cards
vector<vector<int>> card1 = {{1, 3, 5, 7},
{9, 11, 13, 15},
{17, 19, 21, 23},
{25, 27, 29, 31}};
vector<vector<int>> card2 = {{2, 3, 6, 7},
{10, 11, 14, 15},
{18, 19, 22, 23},
{26, 27, 30, 31}};
vector<vector<int>> card3 = {{4, 5, 6, 7},
{12, 13, 14, 15},
{20, 21, 22, 23},
{28, 29, 30, 31}};
vector<vector<int>> card4 = {{8, 9, 10, 11},
{12, 13, 14, 15},
{24, 25, 26, 27},
{28, 29, 30, 31}};
vector<vector<int>> card5 = {{16, 17, 18, 19},
{20, 21, 22, 23},
{24, 25, 26, 27},
{28, 29, 30, 31}};
int sum = 0;
int ip;
display(card1);
cout<< "Type 1 if you could see your birth date in this matrix \n";
cin >> ip;
if(ip == 1)
sum += card1[0][0];
display(card2);
cout<< "Type 1 if you could see your birth date in this matrix \n";
cin >> ip;
if(ip == 1)
sum += card2[0][0];
display(card3);
cout<< "Type 1 if you could see your birth date in this matrix \n";
cin >> ip;
if(ip == 1)
sum += card3[0][0];
display(card4);
cout<< "Type 1 if you could see your birth date in this matrix \n";
cin >> ip;
if(ip == 1)
sum += card4[0][0];
display(card5);
cout<< "Type 1 if you could see your birth date in this matrix \n";
cin >> ip;
if(ip == 1)
sum += card5[0][0];
cout << "Youd birth date is: " << sum;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment