Write a C program to implement a basic billing system for a bookshop that accepts book code and book price for 10 books and at the end, display the total price.
Write a program that inputs three integers from the keyboard and prints the sum,
average, product, smallest and largest of these numbers. The screen dialog should
appear as follows:
Input three different integers: 13 27 14
Sum is 54
Average is 18
Product is 4914
Smallest is 13
Largest is 27
Write a program that asks the user to enter two integers, obtains the numbers from the
user, then prints the larger number followed by the words “is larger.” If the numbers
are equal, print the message “These numbers are equal.”
Write a program that asks the user to enter two numbers, obtains the two numbers
from the user, and prints the sum, product, difference, and quotient of the two
numbers.
define a function that ask a user to enter three numbers and program display the largest using function with return value and argument
Examine the incomplete program below. Write code that can be placed below the comment (// Write your code here) to complete the program. Use nested loops to calculate the sums and averages of each row of scores stored in the 2-dimensional array: students so that when the program executes, the following output is displayed.
Average scores for students:
Student # 1: 12
Student # 2: 22
CODE:
#include <iostream>
using namespace std;
int main()
{
const int NUM_OF_STUDENTS = 2;
const int NUM_OF_TESTS = 3;
int sum = 0, average = 0;
double students[NUM_OF_STUDENTS][NUM_OF_TESTS] =
{
{11, 12, 13},
{21, 22, 23}
};
double averages[NUM_OF_STUDENTS] = {0, 0};
// Write your code here:
cout << "Average scores for students: " << endl;
for (int i = 0; i < NUM_OF_STUDENTS; i++)
cout << "Student # " << i + 1 << ": " << averages[i] << endl;
return 0;
}
Examine the incomplete program below. Write code that can be placed below the comment (// Write your code here) to complete the program. Use nested loops to calculate the sums and averages of each row of scores stored in the 2-dimensional array: students so that when the program executes, the following output is displayed.
OUTPUT:
Average scores for students:
Student # 1: 12
Student # 2: 22
CODE:
#include <iostream>
using namespace std;
int main()
{
const int NUM_OF_STUDENTS = 2;
const int NUM_OF_TESTS = 3;
int sum = 0, average = 0;
double students[NUM_OF_STUDENTS][NUM_OF_TESTS] =
{
{11, 12, 13},
{21, 22, 23}
};
double averages[NUM_OF_STUDENTS] = {0, 0};
// Write your code here:
cout << "Average scores for students: " << endl;
for (int i = 0; i < NUM_OF_STUDENTS; i++)
cout << "Student # " << i + 1 << ": " << averages[i] << endl;
return 0;
}
4. Create a program that will plot the equation of the line y=mx+b using an array.
array1 ==> x - input by user
m = constant - input by user
b = constant - input by user
array2 ==> y - computed
Create a program with a one-dimensional array that searches for a number within the array, and how many times the number appears on the array.
Make a c++ program that will print the average of the values of an array named areas with values 84, 76, 48 using while loop.