Sara is writing a program to input her monthly phone bills and output the month name and amount for the month with maximum amount. She has defined an array to hold the month names.


Complete the pseudocode program.


# Program to output maximum month’s phone bill


MonthName ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]


# Define an array to hold the phone bills for each month  

Respuesta :

Answer:

# include <conio.h>

#include <iostream.h>

using namespace std;

main()

{

int billamount[12];

char monthname["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];

for (int month = 1 ; month<=12; month++)

{

cout<<"Enter the amount of bill for the month"<<month;

cin>>billamount[month];

}

for (i=0; i<= 12; i++)

{

if (billamount[0]<billamount[i])

billamount[0]=billamount[i];

monthname[0]=monthname[i];

}

cout<<"Maximum months phone bill"<<monthname[0]<<"="<<billamount[0]

getch();

}