Answer to Question #163055 in C++ for Ayesha

Question #163055

Write c++ programe to read birthday and get lucky number


1
Expert's answer
2021-02-11T16:57:31-0500
#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
	int d, m, y;
	cout << "Enter your birthday in mm/dd/yyyy format: ";
	cin >> m;
	cin.ignore(32767, '/');
	cin >> d;
	cin.ignore(32767, '/');
	cin >> y;
	srand(d * m * y);
	cout << "Your lucky number is " << rand() % 10 + 1 << "\n";
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment