#include
using namespace std;
int main()
{
const int size = 10;
int arr[size] = {};
int max;
int min;
cout << "The random values in the array are given as:" << endl;
for (int i = 0; i < size; i++)
{
cin>>arr[i];
}
for (int i = 0; i < size; i++)
{
cout << arr[i] << " ";
}
cout << endl;
// To find the min and max;
max = arr[0];
min = arr[0];
for (int i = 0; i < size; i++)
{
if (arr[i] > max)
{
max = arr[i];
}
if (arr[i] < min)
{
min = arr[i];
}
}
cout << "The largest in the array is = " << max << endl;
cout << "The minimum in the array is = " << min << endl;
return 0;
}
#include
using namespace std;
int main()
{
const int size = 4;
double month[size];
double totalRain = 0;
double average_rainFall;
double highest;
double lowest;
cout << "___________Average Rinfall Calculator_________" << endl;
for (int i = 0; i < size; i++)
{
cout << "Enter the rainfall of the month " << i + 1 << " :" << endl;
cin >> month[i];
while(month[i]<0)
{
cout<<"invalid:Input!"<>month[i];
}
totalRain = totalRain + month[i];
}
average_rainFall = totalRain / size;
highest = month[0];
lowest = month[0];
for (int i = 0; i < size; i++)
{
if (month[i] > highest)
{
highest = month[i];
}
if (month[i] < lowest)
{
lowest = month[i];
}
}
cout<<"The total rainfall of the year :"<
#include
#include
using namespace std;
int main()
{
const int size = 5;
string salsa[size] = {"Mild", "Medium", "Sweet", "Hot", "zesty"};
int num_ofJars[size];
int totalSlaes = 0;
int highestSelling;
int lowestSelling;
cout << "___________Salsa Sales Monthly Report_________" << endl;
for (int i = 0; i < size; i++)
{
cout << "Enter the number of jars sold for " << salsa[i] << " :" << endl;
cin >> num_ofJars[i];
while (num_ofJars[i] < 0)
{
cout << "Invalid input!" << endl;
cout << "Please Enter the valid input" << endl;
cout << "Enter the number of jars sold for " << salsa[i] << " :" << endl;
cin >> num_ofJars[i];
}
totalSlaes = totalSlaes + num_ofJars[i];
}
highestSelling = num_ofJars[0];
lowestSelling = num_ofJars[0];
for (int i = 0; i < size; i++)
{
if (num_ofJars[i] > highestSelling)
{
highestSelling = num_ofJars[i];
}
if (num_ofJars[i] < lowestSelling)
{
lowestSelling = num_ofJars[i];
}
}
cout << endl;
cout << "Data of the saled products of the month:" << endl;
for (int i = 0; i < size; i++)
{
cout << "The sales for the " << salsa[i] << " = " << num_ofJars[i] << endl;
}
cout << "The totals sales of the salsa = " << totalSlaes << endl;
cout << "The highest seeling salsa is " << highestSelling << endl;
cout << "The lowest seeling salsa is " << lowestSelling << endl;
return 0;
}
#include
#include
#include
using namespace std;
int main()
{
const int size = 100;
int arr[size];
int n;
for (int i = 0; i < size; i++)
{
arr[i] = (rand() % 500) + 1;
}
cout << "Enter the number :" << endl;
cin >> n;
cout << "All of the numbers in the array that are greater than the number " << n << " are given as:" << endl;
for (int i = 0; i < size; i++)
{
if (arr[i] > n)
{
cout << arr[i] << endl;
}
}
return 0;
}
#include
using namespace std;
int main()
{
const int size = 10;
int arr[size];
int dup_count[size] = {0};
int tally;
cout << "______Unique Elements Detector________" << endl;
for (int i = 0; i < size; i++)
{
cout << "Enter the number " << i + 1 << " :" << endl;
cin >> arr[i];
while (arr[i] < 10 || arr[i] > 100)
{
cout << "Invalid Input!" << endl;
cout << "Enter the number between the 10 and 100 ,inclusive." << endl;
cout << "Enter the number " << i + 1 << " :" << endl;
cin >> arr[i];
}
dup_count[i] = arr[i];
tally++;
int count = 0;
for (int j = 0; j < sizeof(dup_count) / sizeof(int); j++)
{
if (dup_count[j] == arr[i])
{
count++;
}
}
if (count == 2)
{
cout<
#include
using namespace std;
int main()
{
const int seats = 5;
bool flag = true;
int n;
int arr_first[seats] = {0};
int arr_economy[seats] = {0};
int first = 1;
int economy = 6;
char ch;
do
{
cout << " _______________________________________________________" << endl;
cout << "|________________Airline Reservations System____________|" << endl;
cout << "| Welcome Sir! |" << endl;
cout << "| Press 1 to book seat in bussiness Section |" << endl;
cout << "| Press 2 to book seat in economySection |" << endl;
cout << " _______________________________________________________" << endl;
cin >> n;
while (n != 1 && n != 2)
{
cout << "Invalid Input" << endl;
cout << "Please enter the valid input as 1 or 2" << endl;
cin >> n;
}
switch (n)
{
case 1:
{
if (first <= 5)
{
arr_first[first - 1] = first;
cout << "There is available seat in this section!" << endl;
cout << " ________________________________________________" << endl;
cout << "|****************|_1_|-BOARDING PASS*************|" << endl;
cout << "| YOUR SECTION : | 1 |" << endl;
cout << "| YOUR SEAT # : | " << arr_first[first - 1] << " |" << endl;
cout << "| SEATS AVAILABLE IN FIRST CLASS SECTION: |" << endl;
cout << "| Seat # 1: |" << arr_first[0] << " |" << endl;
cout << "| Seat # 2: |" << arr_first[1] << " |" << endl;
cout << "| Seat # 3: |" << arr_first[2] << " |" << endl;
cout << "| Seat # 4: |" << arr_first[3] << " |" << endl;
cout << "| Seat # 5: |" << arr_first[4] << " |" << endl;
cout << " ________________________________________________" << endl;
first++;
}
else if (first > 5)
{
cout << "There is \"NO\" seat available in FIRST CLASS SECTION." << endl;
if (economy <= 10)
{
cout << "There is available seat in the ECONOMOY SECTION:" << endl;
cout << "Are you want to buy it press \"Y\" FOR YES and \"N\" FOR NO!" << endl;
cin >> ch;
ch = tolower(ch);
while (ch != 'y' && ch != 'n')
{
cout << "Invalid Input" << endl;
cout << "Please enter the valid input as y or n" << endl;
cin >> ch;
}
ch = tolower(ch);
switch (ch)
{
case 'n':
{
cout << "Next flight leaves in 3 hours:" << endl;
break;
}
case 'y':
{
if (economy <= 10)
{
arr_economy[economy - 6] = economy;
cout << "There is available seat in this section!" << endl;
cout << " ________________________________________________" << endl;
cout << "|****************|_2_|-BOARDING PASS*************|" << endl;
cout << "| YOUR SECTION : | 2 |" << endl;
cout << "| YOUR SEAT # : | " << arr_economy[economy - 6] << " |" << endl;
cout << "| SEATS AVAILABLE IN ECONOMY CLASS SECTION: |" << endl;
cout << "| Seat # 1: |" << arr_economy[0] << " |" << endl;
cout << "| Seat # 2: |" << arr_economy[1] << " |" << endl;
cout << "| Seat # 3: |" << arr_economy[2] << " |" << endl;
cout << "| Seat # 4: |" << arr_economy[3] << " |" << endl;
cout << "| Seat # 5: |" << arr_economy[4] << " |" << endl;
cout << " ________________________________________________" << endl;
economy++;
}
break;
}
}
}
if (economy > 10)
{
cout << "You have booked last seat,There is also \"NO\" seats available now in FIRST CLASS SECTION." << endl;
cout << "You have booked last seat,There is also \"NO\" seats available now in ECONOMY CLASS SECTION." << endl;
cout << "Next flight leaves in 3 hours:" << endl;
flag = false;
}
}
break;
}
case 2:
{
if (economy <= 10)
{
arr_economy[economy - 6] = economy;
cout << "There is available seat in this section!" << endl;
cout << " ________________________________________________" << endl;
cout << "|****************|_2_|-BOARDING PASS*************|" << endl;
cout << "| YOUR SECTION : | 2 |" << endl;
cout << "| YOUR SEAT # : | " << arr_economy[economy - 6] << " |" << endl;
cout << "| SEATS AVAILABLE IN ECONOMY CLASS SECTION: |" << endl;
cout << "| Seat # 1: |" << arr_economy[0] << " |" << endl;
cout << "| Seat # 2: |" << arr_economy[1] << " |" << endl;
cout << "| Seat # 3: |" << arr_economy[2] << " |" << endl;
cout << "| Seat # 4: |" << arr_economy[3] << " |" << endl;
cout << "| Seat # 5: |" << arr_economy[4] << " |" << endl;
cout << " ________________________________________________" << endl;
economy++;
}
else if (economy > 10)
{
cout << "There is \"NO\" seat available in ECONOMY CLASS SECTION." << endl;
if (first <= 5)
{
cout << "There is available seat in the FIRST SECTION:" << endl;
cout << "Are you want to buy it press \"Y\" FOR YES and \"N\" FOR NO!" << endl;
cin >> ch;
ch = tolower(ch);
while (ch != 'y' && ch != 'n')
{
cout << "Invalid Input" << endl;
cout << "Please enter the valid input as y or n" << endl;
cin >> ch;
}
ch = tolower(ch);
switch (ch)
{
case 'n':
{
cout << "Next flight leaves in 3 hours:" << endl;
break;
}
case 'y':
{
if (first <= 5)
{
arr_first[first - 1] = first;
cout << "There is available seat in this section!" << endl;
cout << " ________________________________________________" << endl;
cout << "|****************|_1_|-BOARDING PASS*************|" << endl;
cout << "| YOUR SECTION : | 1 |" << endl;
cout << "| YOUR SEAT # : | " << arr_first[first - 1] << " |" << endl;
cout << "| SEATS AVAILABLE IN FIRST CLASS SECTION: |" << endl;
cout << "| Seat # 1: |" << arr_first[0] << " |" << endl;
cout << "| Seat # 2: |" << arr_first[1] << " |" << endl;
cout << "| Seat # 3: |" << arr_first[2] << " |" << endl;
cout << "| Seat # 4: |" << arr_first[3] << " |" << endl;
cout << "| Seat # 5: |" << arr_first[4] << " |" << endl;
cout << " ________________________________________________" << endl;
first++;
}
break;
}
}
}
if (first > 5)
{
cout << "You have booked last seat,There is also \"NO\" seats available now in FIRST CLASS SECTION." << endl;
cout << "You have booked last seat,There is also \"NO\" seats available now in ECONOMY CLASS SECTION." << endl;
cout << "Next flight leaves in 3 hours:" << endl;
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.