#include
using namespace std;
struct phoneNumber
{
int areaCode;
int exchange;
int number;
};
int main()
{
phoneNumber phone1, phone2;
phone1.areaCode = 212;
phone1.exchange = 767;
phone1.number = 8900;
cout << "Enter your area code:" << endl;
cin >> phone2.areaCode;
cout << "Enter your exhahange :" << endl;
cin >> phone2.exchange;
cout << "Enter your number:" << endl;
cin >> phone2.number;
cout << "My number is (" << phone1.areaCode << ") " << phone1.exchange << "-" << phone1.number << endl;
cout << "Your number is (" << phone2.areaCode << ") " << phone2.exchange << "-" << phone2.number << endl;
return 0;
}
#include
using namespace std;
struct point{
float x,y;
};
int main()
{
point point1,point2,sum;
cout<<"Enter the x coordinate of point_1:"<>point1.x;
cout<<"Enter the y coordinate of point_1:"<>point1.y;
cout<>point2.x;
cout<<"Enter the y coordinate of point_2:"<>point2.y;
sum.x=point1.x+point2.x;
sum.y=point1.y+point2.y;
cout<<"The coordinates of p1+p2 are: ("<
#include
using namespace std;
struct employee
{
int emplNumber;
float emplCompensation;
};
int main()
{
employee emp[3];
for (int i = 0; i < 3; i++)
{
cout << "Enter the number of the empolyee " << i + 1 << " :" << endl;
cin >> emp[i].emplNumber;
cout << "Enter the compensation of the empolyee " << i + 1 << " in dollars:" << endl;
cout << "$";
cin >> emp[i].emplCompensation;
}
cout << "________________________________________________________________" << endl;
cout << "The empolyee data of these three empolyees are as:" << endl;
for (int i = 0; i < 3; i++)
{
cout << "The number of the empolyee_" << i + 1 << " : " << emp[i].emplNumber << endl;
cout << "The compensation of the empolyee_" << i + 1 << " : $" << emp[i].emplCompensation << endl;
}
return 0;
}
#include
using namespace std;
struct time{
int hours;
int minutes;
int seconds;
};
int main()
{
time t1;
long totalsecs;
cout<<"Enter the hours:"<>t1.hours;
cout<<"Enter the minutes:"<>t1.minutes;
cout<<"Enter the seconds:"<>t1.seconds;
totalsecs=(t1.hours*3600) + (t1.minutes*60) + (t1.seconds);
cout<<"The total number of seconds in the time "<
#include
using namespace std;
struct time
{
int hours;
int minutes;
int seconds;
};
int main()
{
time t[2];
time finalTime;
long totalsecs = 0;
for (int i = 0; i < 2; i++)
{
cout << "Enter the hours of time:" << i + 1 << endl;
cin >> t[i].hours;
cout << "Enter the minutes of time:" << i + 1 << endl;
cin >> t[i].minutes;
cout << "Enter the seconds of time:" << i + 1 << endl;
cin >> t[i].seconds;
cout << "_________________________________________" << endl;
cout << endl;
totalsecs += (t[i].hours * 3600 + t[i].minutes * 60 + t[i].seconds);
}
finalTime.hours = (totalsecs / 3600);
finalTime.minutes = (totalsecs - (3600 * finalTime.hours)) / 60;
finalTime.seconds = (totalsecs - (3600 * finalTime.hours) - (finalTime.minutes * 60));
cout << "The total number of seconds in the final sum of 2 times =" << finalTime.hours << ":" << finalTime.minutes << ":" << finalTime.seconds << endl;
return 0;
}
#include
using namespace std;
struct weather
{
float totalRain;
float highTemp;
float lowTemp;
float averageTemp;
};
int main()
{
const int size = 12;
weather month[size];
double average_monthRain;
double total_rainFall;
double total_avergeTemp;
double average_averTemp;
float highTemp_forYear;
float lowTemp_forYear;
int lowMon_num = 0;
int highMon_num = 0;
for (int i = 0; i < size; i++)
{
cout << "Enter the total rainfall of the month " << i + 1 << endl;
cin >> month[i].totalRain;
cout << "Enter the high temperature of the month" << i + 1 << endl;
cin >> month[i].highTemp;
while (month[i].highTemp > 140 || month[i].highTemp < -100)
{
cout << "Invalid Input!" << endl;
cout << ": Only accept temperatures within the range between -100 and +140 degrees Fahrenheit." << endl;
cout << "Please renter the high temperature!" << endl;
cout << "Enter the high temperature of the month" << i + 1 << endl;
cin >> month[i].highTemp;
}
cout << "Enter the low temperature of the month" << i + 1 << endl;
cin >> month[i].lowTemp;
while (month[i].lowTemp > 140 || month[i].lowTemp < -100)
{
cout << "Invalid Input!" << endl;
cout << ": Only accept temperatures within the range between -100 and +140 degrees Fahrenheit." << endl;
cout << "Please renter the low temperature!" << endl;
cout << "Enter the low temperature of the month" << i + 1 << endl;
cin >> month[i].lowTemp;
}
month[i].averageTemp = (month[i].highTemp + month[i].lowTemp) / 2;
}
total_rainFall = 0;
total_avergeTemp = 0;
highTemp_forYear = month[0].highTemp;
lowTemp_forYear = month[0].lowTemp;
for (int i = 0; i < size; i++)
{
total_rainFall += month[i].totalRain;
total_avergeTemp += month[i].averageTemp;
if (highTemp_forYear < month[i].highTemp)
{
highTemp_forYear = month[i].highTemp;
highMon_num = i + 1;
}
if (lowTemp_forYear > month[i].lowTemp)
{
lowTemp_forYear = month[i].lowTemp;
lowMon_num = i + 1;
}
}
average_monthRain = total_rainFall / size;
average_averTemp = total_avergeTemp / size;
cout << "The average monthly rainfall = " << average_monthRain << endl;
cout << "The total rainfall for the year = " << total_rainFall << endl;
cout << "The highest temperature for the year " << highTemp_forYear << " in the month of " << highMon_num << " is occured." << endl;
cout << "The lowest temperature for the year " << lowTemp_forYear << " in the month of " << lowMon_num << " is occured." << endl;
cout << "The average of all the monthly average temperatures = " << average_averTemp << endl;
return 0;
}
#include
#include
using namespace std;
struct date
{
int year;
int month;
int day;
};
struct city
{
string city;
string state;
string zip;
};
struct customer
{
string name;
string address;
city ct;
long long int number;
float balance;
date date;
};
int main()
{
customer cust[10];
char ch;
char ele;
int i = 0; // index
int j;
bool flag = true;
bool element = true;
string nameSearch;
do
{
cout << " -----------------------------------------------------" << endl;
cout << "| Enter \"I\" to Insert Customer: |" << endl;
cout << "| Enter \"E\" to Edit the existing Customer: |" << endl;
cout << "| Enter \"A\" to Print all the Customers: |" << endl;
cout << "| Enter \"S\" to Search the particular Customer: |" << endl;
cout << "| Enter \"Q\" to Exit the program!: |" << endl;
cout << " -----------------------------------------------------" << endl;
cin >> ch;
ch = tolower(ch);
switch (ch)
{
case 'i':
{
cout << "Adding customer:" << i + 1 << endl;
cin.ignore();
cout << "Enter the name of the customer " << i + 1 << " :" << endl;
getline(cin, cust[i].name);
while (cust[i].name == "")
{
cout << "Please fill the input!" << endl;
cout << "Enter the name of the customer " << i + 1 << " :" << endl;
getline(cin, cust[i].name);
}
cout << "Enter the address of the customer " << i + 1 << " :" << endl;
getline(cin, cust[i].address);
while (cust[i].address == "")
{
cout << "Please fill the input!" << endl;
cout << "Enter the address of the customer " << i + 1 << " :" << endl;
getline(cin, cust[i].address);
}
cout << "Enter the City of the customer " << i + 1 << " :" << endl;
getline(cin, cust[i].ct.city);
while (cust[i].ct.city == "")
{
cout << "Please fill the output!" << endl;
cout << "Enter the City of the customer " << i + 1 << " :" << endl;
getline(cin, cust[i].ct.city);
}
cout << "Enter the State of the customer " << i + 1 << " :" << endl;
getline(cin, cust[i].ct.state);
while (cust[i].ct.state == "")
{
cout << "Please fill the output!" << endl;
cout << "Enter the State of the customer " << i + 1 << " :" << endl;
getline(cin, cust[i].ct.state);
}
cout << "Enter the ZIP of the customer " << i + 1 << " :" << endl;
getline(cin, cust[i].ct.zip);
while (cust[i].ct.zip == "")
{
cout << "Please fill the output!" << endl;
cout << "Enter the ZIP of the customer " << i + 1 << " :" << endl;
getline(cin, cust[i].ct.zip);
}
cout << "Enter the TELEPNOE # of the customer " << i + 1 << " :" << endl;
cin >> cust[i].number;
while (cust[i].number < 0)
{
cout << "Please fill the positive number output!" << endl;
cout << "Enter the Telephone of the customer " << i + 1 << " :" << endl;
cin >> cust[i].number;
}
cout << "Enter the Account Balance of the customer " << i + 1 << " :" << endl;
cout << "$";
cin >> cust[i].balance;
while (cust[i].balance < 0)
{
cout << "Please fill the positive account balance output!" << endl;
cout << "Enter the account balance of the customer " << i + 1 << " :" << endl;
cout << "$";
cin >> cust[i].balance;
}
cout << "Enter the date for the customer " << i + 1 << " :" << endl;
cout << "Enter year:";
cin >> cust[i].date.year;
cout << "Enter month:";
cin >> cust[i].date.month;
cout << "Enter the day:";
cin >> cust[i].date.day;
i++;
break;
}
case 'e':
{
if (i == 0)
{
cout << "Please first add the minimum 1 customer data:" << endl;
}
else
{
cout << "Enter the customer index to change [1 to " << i << "]:" << endl;
cin >> j;
j--;
do
{
cout << cust[j].name << endl;
cout << cust[j].address << endl;
cout << cust[j].number << endl;
cout << cust[j].balance << endl;
cout << cust[j].ct.city << endl;
cout << cust[j].ct.state << endl;
cout << cust[j].ct.zip << endl;
cout << cust[j].date.year << endl;
cout << cust[j].date.month << endl;
cout << cust[j].date.day << endl;
cout << " -------------------------------------------" << endl;
cout << "| To Edit the elements: |" << endl;
cout << "| N = Name | A= Adrdress |" << endl;
cout << "| T = Telephone | B= Balance |" << endl;
cout << "| C = City | S= State |" << endl;
cout << "| Z = ZIP | Y= year |" << endl;
cout << "| M = Month | D= Day |" << endl;
cout << "| E = Done editing this customer |" << endl;
cout << " -------------------------------------------" << endl;
cin >> ele;
ele = tolower(ele);
cin.ignore();
switch (ele)
{
case 'n':
{
cout << "Enter the edited name:" << endl;
getline(cin, cust[j].name);
break;
}
case 'a':
{
cout << "Enter the edited address:" << endl;
getline(cin, cust[j].address);
break;
}
case 't':
{
cout << "Enter the edited Telephone number:" << endl;
cin >> cust[j].number;
break;
}
case 'b':
{
cout << "Enter the edited balance:" << endl;
cin >> cust[j].balance;
break;
}
case 'c':
{
cin.ignore();
cout << "Enter the edited city:" << endl;
getline(cin, cust[j].ct.city);
break;
}
case 's':
{
cout << "Enter the edited State:" << endl;
getline(cin, cust[j].ct.state);
break;
}
case 'z':
{
cout << "Enter the edited ZIP:" << endl;
getline(cin, cust[j].ct.zip);
break;
}
case 'y':
{
cout << "Enter the edited year:" << endl;
cin >> cust[j].date.year;
break;
}
case 'm':
{
cout << "Enter the edited month:" << endl;
cin >> cust[j].date.month;
break;
}
case 'd':
{
cout << "Enter the edited day:" << endl;
cin >> cust[j].date.day;
break;
}
case 'e':
{
element = false;
break;
}
}
} while (element == true);
}
break;
}
case 'a':
{
if (i == 0)
{
cout << "Please first add the minimum 1 customer data:" << endl;
}
else
{
cout << "The data of all the customers is:" << endl;
for (int k = 0; k < i; k++)
{
cout << "DATA OF CUSTOMER " << k + 1 << " :" << endl;
cout << " __________________________________________________________________" << endl;
cout << "| Name: | " << cust[k].name << " " << endl;
cout << "| Address: | " << cust[k].address << " " << endl;
cout << "| Telephone #: | " << cust[k].number << " " << endl;
cout << "| Account Balance: | " << cust[k].balance << " " << endl;
cout << "| City: | " << cust[k].ct.city << " " << endl;
cout << "| State: | " << cust[k].ct.state << " " << endl;
cout << "| ZIP: | " << cust[k].ct.zip << " " << endl;
cout << "| Year: | " << cust[k].date.year << " " << endl;
cout << "| Month: | " << cust[k].date.month << " " << endl;
cout << "| Day: | " << cust[k].date.day << " " << endl;
cout << " ___________________________________________________________________" << endl;
cout << endl;
}
}
break;
}
case 's':
{
if (i == 0)
{
cout << "Please first add the minimum 1 customer data:" << endl;
}
else
{
cout << "Search the particular customer by its name :" << endl;
cout << "Enter the name of the customer:" << endl;
cin.ignore();
getline(cin, nameSearch);
for (int s = 0; s < i; s++)
{
if (cust[s].name == nameSearch)
{
cout << "DATA OF CUSTOMER " << nameSearch << " :" << endl;
cout << " __________________________________________________________________" << endl;
cout << "| Name: | " << cust[s].name << " " << endl;
cout << "| Address: | " << cust[s].address << " " << endl;
cout << "| Telephone #: | " << cust[s].number << " " << endl;
cout << "| Account Balance: | " << cust[s].balance << " " << endl;
cout << "| City: | " << cust[s].ct.city << " " << endl;
cout << "| State: | " << cust[s].ct.state << " " << endl;
cout << "| ZIP: | " << cust[s].ct.zip << " " << endl;
cout << "| Year: | " << cust[s].date.year << " " << endl;
cout << "| Month: | " << cust[s].date.month << " " << endl;
cout << "| Day: | " << cust[s].date.day << " " << endl;
cout << " ___________________________________________________________________" << endl;
cout << endl;
}
}
}
break;
}
case 'q':
{
flag = false;
break;
}
}
} while (flag == true);
return 0;
}
}
If you don't find any problem,in this website and if you have a very difficult assignment question that is not present on internet ,then you dont bother yourself,we are here to solve every problem of your life you just click on the Problem asking button and write your problem we slove the code of your problem and sent you on your email addres that you put in the sin up form.