Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Sample Input: Number of students ( must be a positive n umber less than or equal

ID: 3821938 • Letter: S

Question

Sample Input:

Number of students (must be a positive number less than or equal to 50) = ? 3

Please enter the information for student 1.

Name: Mary Jones

Home Address:

Street Address: 45 Ash

   City, State: City, State

   Zip Code: ZIP

College Address:

Street Address: 32 Elm

   City, State: City, state

   Zip Code: zip

Please enter the information for student 2.

Name: Lisa Mills

  Home Address:

Street Address: 34 Spruce

   City, State: City, State

   Zip Code: 72173

College Address:

Street Address: 56 Pine

   City, State: city, state

   Zip Code: 72032

Please enter the information for student 3.

Name: Mike Hester

Home Address:

Street Address: 3 Oak

   City, State: City, state

   Zip Code: 72058

College Address:

Street Address: 5 Cedar

   City, State: city, state

   Zip Code: 72034

Sample Output:

The Student Address report is:

Mary Jones

  Home: 45 Ash

  City, AR   72110

College: 32 Elm

     City, AR   72034

Lisa Mills

  Home: 34 Spruce

   City, AR   72173

College: 56 Pine

     City, AR  72032

Mike Hester

  Home: 3 Oak

City, AR  72058

College: 5 Cedar

   City, AR  72034

Explanation / Answer


#include<iostream>
//Structure declaration to store home address
struct HomeAddress
{
char StreetAddress[25];
char CityState[100];
char ZipCode[25];
};
//Structure declaration to store College address
struct CollegeAddress
{
char StreetAddress[25];
char CityState[100];
char ZipCode[25];
};

//Structure declaration to store the details of Student
struct StudentAddress
{
char Name[25];
struct HomeAddress homeAdd;
struct CollegeAddress collAdd;
};

int main()
{
int n=0;
  
std::cout << " Number of students (must be a positive number less than or equal to 50) = ? ";
std::cin >> n;
//Declaring the Structure to store the information of students
StudentAddress S[n];

  
//code to take input from the user
for(int i=0; i < n;i++){
  
std::cout << " Please enter the information for student " << i+1;
std::cout << " Name : ";
std::cin >> S[i].Name;
  
std::cout << " Home Address : ";
std::cout << " StreetAddress : ";
std::cin >>S[i].homeAdd.StreetAddress;
std::cout << " City,State : ";
std::cin >>S[i].homeAdd.CityState;
std::cout << " ZipCode : ";
std::cin >>S[i].homeAdd.ZipCode;
  
std::cout << " College Address : ";
std::cout << " StreetAddress : ";
std::cin >>S[i].collAdd.StreetAddress;
std::cout << " City,State : ";
std::cin >>S[i].collAdd.CityState;
std::cout << " ZipCode : ";
std::cin >>S[i].collAdd.ZipCode;
  
  
}
  
//code to print the output to the console
std::cout<<" The Student Address report is: ";
for(int i=0;i<n;i++){
  
std::cout << " "<<S[i].Name;
  
std::cout << " Home : ";
std::cout << " "<<S[i].homeAdd.StreetAddress;
std::cout << " "<<S[i].homeAdd.CityState;
std::cout << " "<<S[i].homeAdd.ZipCode;
  
std::cout << " College :";
std::cout << " "<<S[i].collAdd.StreetAddress;
std::cout << " "<<S[i].collAdd.CityState;
std::cout << " "<<S[i].collAdd.ZipCode;
}


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote