Create a C++ program using conditional statement. Read the worded problem below.
Supposed we have a client, he/she wanted you to create a program for his/her business.
He/She wanted to record the employee’s information. Now, on programmer’s side (You), we
have 3 buttons, the ADD, UPDATE, DELETE.
A. When we click DELETE button, there will be a notification telling the user of the program
if he/she wanted to delete the employee’s record. The pop-up information/display
when DELETE button is pressed: “Are you sure you want to delete this record?”
B. When the button ADD is pressed/triggered, it will display “Are you sure you wanted to
add this file?”
C. When the button UPDATE is pressed, it will display “Are you sure you want to update
this record?”
#include<iostream>
using namespace std;
void Menu()
{
cout << "\nPlease, make a choice from the following\n"
<< "D - DELETE the employee's record\n"
<< "A - ADD the employee's record\n"
<< "U - UPDATE the employee's record\n"
<< "Q - QUIT program\n";
cout << "Your choice: ";
}
int main()
{
char c;
Menu();
while (cin >> c)
{
if (c == 'A' || c == 'a')
{
cout << "Are you sure you wanted to add this file ?\n";
}
else if (c == 'D' || c == 'd')
{
cout << "Are you sure you want to delete this record ?\n";
}
else if (c == 'U' || c == 'u')
{
cout << "Are you sure you want to update this record ?\n";
}
else if (c == 'Q' || c == 'q')
{
break;
}
else
{
cout << "Make another choice!\n";
}
Menu();
}
}
Comments
Leave a comment