Question

On Dev C++, write a C++ program that prompts the user with the following option: 1)...

On Dev C++, write a C++ program that prompts the user with the following option: 1) to enter a student information such as First Name, Last Name, SS# formatted as ###-##-####, userID and Password and store them into a struct data type. 2) to display the student information as shown in the example below: Name: Mary Last Name: Parker SS#: 000-00-1398 userID: mParker Password: ******** 3) Exit the program.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>
#include<algorithm>
#include<string>
#include<process.h>
#include<stdlib.h>

using namespace std;

struct info
{
string fname;
string lname;
string ssn;
string userID;
string password;
};
struct info s1;

int main()
{
struct info s1;
int choice;

while(1)
{
cout<<"\n\n1..Enter student Information:"<<endl;
cout<<"2.. Display the sudent Information."<<endl;
cout<<"3. Exit"<<endl<<endl;
cout<<"Enter your choice : ";
cin>>choice;

switch(choice)
{
case 1:
cout<<"Enter First Name : ";
cin>>s1.fname;
cout<<"Enter Last Name : ";
cin>>s1.lname;
cout<<"Enter SSN Number : ";
cin>>s1.ssn;
cout<<"Enter UserName : ";
cin>>s1.userID;
cout<<"Enter Password : ";
cin>>s1.password;
break;

case 2:
   int i;
cout<<"First Name : "<<s1.fname<<endl;
cout<<"Last Name : "<<s1.lname<<endl;
cout<<"SSN : "<<s1.ssn<<endl;
cout<<"UserID : "<<s1.userID<<endl;
//cout<<"Password : "<<s1.password<<endl<<endl;
for(i=0;i<s1.password.length();i++ )
{
std::replace(s1.password.begin(),s1.password.end(),s1.password[i] ,'*' );
}
cout<<"Password : "<<s1.password<<endl<<endl;
break;

case 3:
exit(0);

default:
cout<<"Invalid option .";
break;
}
}
cout<<endl;
system("pause");
return 0;
}

Add a comment
Know the answer?
Add Answer to:
On Dev C++, write a C++ program that prompts the user with the following option: 1)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that performs the following: 1. Presents the user a menu where they choose...

    Write a program that performs the following: 1. Presents the user a menu where they choose between:              a. Add a new student to the class                           i. Prompts for first name, last name                           ii. If assignments already exist, ask user for new student’s scores to assignments              b. Assign grades for a new assignment                           i. If students already exist, prompt user with student name, ask them for score                           ii. Students created after assignment will need to...

  • Q3: Write a Python program the prompts the user for information for stu num students. For...

    Q3: Write a Python program the prompts the user for information for stu num students. For each student prompt for the student ID and three quiz grades. Use a nested loop, where the inner loop prompts for the three quiz grades. Print the student's name and average, formatted to two decimal places. The sample output below is when stu_num -3. Enter name of student 1 Mary Jones Enter Score 1: 78 Enter soore 2: 90 Enter soore 3: 91 Name:...

  • Write a C program that prompts the user for the number for times the user wants...

    Write a C program that prompts the user for the number for times the user wants to flip a coin. Your program will flip a virtual coin that number of times and return the following: 1) The number of times heads occurred. 2) The number of times tails occured. Then take the coin flip program and modify the random number generator to roll a single 6-sided dice.   DO NOT DISPLAY THE RESULTS OF EACH ROLL. 1) Ask the user how...

  • Write a C# program that prompts a user to enter a birth month and day. Display...

    Write a C# program that prompts a user to enter a birth month and day. Display an error message if the month is invalid (not 1 through 12) or the day is invalid for the month (for example, not between 1 and 31 for January or between 1 and 29 for February). If the month and day are valid, display them with a message.

  • Write a program that prompts the user for a String value and a character value. The...

    Write a program that prompts the user for a String value and a character value. The program should then find the last occurrence of the provided character in the provided String and display the corresponding index. If the character is not found in the String, display -1. For additional challenge, create a multi-class solution. The business class should consist of two instance varaibles to store the user provided values and one method to accomplish the given task. The tester class...

  • Write a program that separately prompts the user for a first name and last name and...

    Write a program that separately prompts the user for a first name and last name and outputs a string containing the following information, in order: a. First letter of the user's name. b. First five letters of the user's last name. c. A random two-digit integer You must construct the desired string ensuring all characters are lowercase; output the identification string accordingly. Assume the last name contains at least 5 characters. You must use the Random (java.util.Random) class to generate...

  • in c++ program Write a C + + program that prompts the user to input the...

    in c++ program Write a C + + program that prompts the user to input the elapsed time for an event in seconds. The program then outputs the elapsed time in hours, minutes, and seconds. (For example, if the elapsed time is 9630 seconds, then the output is 2:40:30.)

  • JAVA Write a program that prompts the user to enter a file name, then opens the...

    JAVA Write a program that prompts the user to enter a file name, then opens the file in text mode and reads it. The input files are assumed to be in CSV format. The input files contain a list of integers on each line separated by commas. The program should read each line, sort the numbers and print the comma separated list of integers on the console. Each sorted list of integers from the same line should be printed together...

  • Write a program in visual c# program named CheckMonth that prompts a user to enter a...

    Write a program in visual c# program named CheckMonth that prompts a user to enter a birth month. If the value entered is greater than 12 or less than 1, display an error message; otherwise, display the valid month with a message such as 3 is a valid month.

  • 1. Write a program that prompts the user to enter three integers and display the integers...

    1. Write a program that prompts the user to enter three integers and display the integers in non-decreasing order. You can assume that all numbers are valid. For example: Input Result 140 -5 10 Enter a number: Enter a number: Enter a number: -5, 10, 140 import java.util.Scanner; public class Lab01 { public static void main(String[] args) { Scanner input = new Scanner(System.in);    } } ---------------------------------------------------------------------------------------------------------------------------- 2. Write a program that repeatedly prompts the user for integer values from...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT