Question

a. Write a program that reads your id and full name and display. And also display the index of first letter and last letter o
0 0
Add a comment Improve this question Transcribed image text
Answer #1
 #include<stdio.h> #include<iostream> using namespace std; int main(){      string id;      string name;    cout<<"Enter ID: ";       getline(cin,id);        cout<<"Enter Name: ";     getline(cin,name);      cout<<"\nID: "<<id<<endl;     cout<<"Name: "<<name<<endl;   string course;  cout<<"\nEnter course: ";         getline(cin,course);    if(course != "comp2002")                course.clear();         else            course += "Computer Science Department";        cout<<"\nCourse: "<<course<<endl;     string college;         cout<<"\nEnter College:";         getline(cin,college);   if(college == "")               college = "College of Science";         cout<<"\nCollege: "<<college<<endl; }

OutPuts:

Enter ID: A123456 Enter Name: ABCD WXYZ ID: A123456 Name: ABCD WXYZ Enter course: comp2002 Course: comp2002 Computer Science

Enter ID: A1234 Enter Name: RGT hjkh ID: A1234 Name: RGT hjkh Enter course: comp2 Course: Enter College: College: College of

Add a comment
Know the answer?
Add Answer to:
a. Write a program that reads your id and full name and display. And also display...
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
  • This Java program reads an integer from a keyboard and prints it out with other comments....

    This Java program reads an integer from a keyboard and prints it out with other comments. Modify the comments at the top of the program to reflect your personal information. Submit Assignment1.java for Assignment #1 using Gradescope->Assignemnt1 on canvas.asu.edu site. You will see that the program has a problem with our submission. Your program is tested with 4 testcases (4 sets of input and output files). In order to pass all test cases, your program needs to produce the same...

  • Use Java programing Write a program to display information about schools in North Carolina that offer...

    Use Java programing Write a program to display information about schools in North Carolina that offer a BS in Computer Science. The data file "NCuniversity Data dat" contains the following information on each line: BS in CS Instate cost Out of state cost int int int double fraction of students who return after first year String name of the school 0-no, 1-yes, 2-online only Expected annual cost for an in-state student Expected annual cost for an out of state student...

  • Write a C++ program that produces the following output: /* OUTPUT Enter your age: 21 Enter...

    Write a C++ program that produces the following output: /* OUTPUT Enter your age: 21 Enter the last name: Lee Hello Tom Lee. You are 21 years old. Press any key */   Declare an array named: firstName The array is a c_string, i.e., it is a null-terminated character array. The size of the array is 10. Assign a first name to it when it is declared.   Declare an array named: lastName The array is a c_string, The size of the...

  • 7.3: The Price is Right Write a program that reads in a price as a String,...

    7.3: The Price is Right Write a program that reads in a price as a String, and then outputs the price in dollars and cents. Name your project PriceRight and create a class called PriceRight.java For this program, you can assume that the user will enter in a price in either 10s or 100s of dollars. The price will never go above 999.99 or below 10.00. Hint: read in the price as a String Hint 2: Use the String methods...

  • Jubail University College Computer Science & Engineering Department Assessmen Assignment Course Code CS120/C5101 t Type: 1...

    Jubail University College Computer Science & Engineering Department Assessmen Assignment Course Code CS120/C5101 t Type: 1 Semester: 403 Course Title Programming Submission 27-06-2020 Total Points 8 Date Submission Instructions: • This is an individual assignment. • Please submit your program (Java fle) in Blackboard. You can create one java project, named as Assignment1_id and add separate java file for each question. You can name your javá files as 01.02.... etc. • Make sure that you include your student ID name...

  • In order to do Program 6, Program 5 should bemodified.Program 6

    In order to do Program 6, Program 5 should be modified.Program 6-----------------------------------Program 4----------------------------------------------- (abstract class exception handling) Modify program4 to meet the following requirements: I. Make Person, Employee classes to abstract classes. Cl0%) 2. Add an interface interface working with a method teach() (5%) interface working void teach(String course) J 3. Modify Faculty class. (20%) a. a private data field and implement existing b. Modify Faculty class as a subclass of addition to the c. toString or print Info) method to...

  • Write the program FindPatientRecords that prompts the user for an ID number, reads records from Patients.txt,...

    Write the program FindPatientRecords that prompts the user for an ID number, reads records from Patients.txt, and displays data for the specified record. If the record does not exist, display the following error message: No records found for p# using System; using static System.Console; using System.IO; class FindPatientRecords { static void Main() { // Your code here } }

  • Write the program FindPatientRecords that prompts the user for an ID number, reads records from Patients.txt,...

    Write the program FindPatientRecords that prompts the user for an ID number, reads records from Patients.txt, and displays data for the specified record. If the record does not exist, display the following error message: No records found for p# using System; using static System.Console; using System.IO; class FindPatientRecords { static void Main() { // Your code here } }

  • Problem Specification: Write a C++ program to calculate student’s GPA for the semester in your class. For each student, the program should accept a student’s name, ID number and the number of courses...

    Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...

  • User Profiles Write a program that reads in a series of customer information -- including name,...

    User Profiles Write a program that reads in a series of customer information -- including name, gender, phone, email and password -- from a file and stores the information in an ArrayList of User objects. Once the information has been stored, the program should welcome a user and prompt him or her for an email and password The program should then use a linearSearch method to determine whether the user whose name and password entered match those of any of...

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