The post office needs a program that reads in postal address data and then displays the data in a neat format.
declare four string variable name ,addr1, addr2 and postalCode.
First ,the main function of the program must input the data by means of a function called inputData
#include<iostream>
using namespace std;
void inputData(){
int addr1,addr2,postalCode;
char name[20];
cout<<"Enter name"<<endl;
cin>>name;
cout<<"Enter address 1"<<endl;
cin>>addr1;
cout<<"Enter address 2"<<endl;
cin>>addr2;
cout<<"postal code"<<endl;
cin>>postalCode;
cout<<"POSTAL INFORMATION"<<endl;
cout<<"Name "<<name<<endl;
cout<<"Address 1"<<addr1<<endl;
cout<<" Address 2 "<<addr2<<endl;
cout<<"postal code "<<postalCode<<endl;
}
int main(){
inputData();
return 0;}
Comments
Leave a comment