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

Input Test Data Use the following for the test data: Input Test Run 1 Enter the

ID: 3567734 • Letter: I

Question

Input Test Data Use the following for the test data: Input Test Run 1 Enter the character to be used in the header: * Enter the number of characters to be printed in the header line: 31 Enter Your Full Name: John Smith Enter Your Street Address: 321 Golf Club Road Enter Your City and State Address: Pleasant Hill, CA 94523 Enter the character to be used in the footer: Enter the number of `#' characters to be printed in the footer line: 24 Output Test Run 1 ****************************** John Smith 321 Golf ClubRoad Pleasant Hill, CA 94523 ########################

Explanation / Answer

#include<iostream>
#include<stdio.h>

using namespace std;

int main(){
char name[20], address[30], cityAddress[30];
char header,footer;
int headerCount =0 , footerCount = 0;

cout <<"Enter the character to be used in the header: ";
fflush(stdin);
cin >> header;
cout << "Enter the number of characters to be printed in the header line: ";
cin >> headerCount;
cout << "Enter Your Full Name: ";
fflush(stdin);
gets(name);
cout << "Enter Your Street Address: ";
fflush(stdin);
gets(address);
cout << "Enter Your Coty and State Address: ";
fflush(stdin);
gets(cityAddress);
cout <<"Enter the character to be used in the footer: ";
fflush(stdin);
cin >> footer;
cout << "Enter the number of characters to be printed in the footer line: ";
cin >> footerCount;

for(int i=0; i<headerCount; i++){
cout <<header;
}
cout << endl;
cout << name << endl;
cout << address << endl;
cout << cityAddress << endl;
for(int i=0; i<footerCount; i++){
cout <<footer;
}
cout << endl;

return 0;
}