Compute and display the output of the Area (A) of a rectangle, the length (L) is 10 and the width (W) is 15.
1) Write a program that declares a structure to store the record of a book. It defines a structure variable, input the values and displays them using pointer.
2) Write a program that input two integers and passes them to a function using pointers. The function exchange the values and the program finally display the values.
Modify the codes given below so that the program is able to display the number of digits and alphabets
entered by the user. Use function to display it.
#include<iostream>
using namespace std;
int main()
{
char input;
for(int counter = 0; counter < 10; counter++)
{
cout<<"Enter a symbol: ";
cin>>input;
}
return 0;
}
Modify the given program so that the program is able to calculate and display the number of male and
female employees. Use a function name displayGender() to display counter number of gender.
#include<iostream>
using namespace std;
int main()
{
char name[30];
char gender;
for(int counter = 0; counter < 5; counter++)
{
cout<<"Name of the employee: ";
cin>>ws;
cin.getline(name, 30);
cout<<"Gender of the employee (M / F): ";
cin>>gender;
}
return 0;
}
QUESTION 2
Modify the codes given below so that the program is able to display the number of digits and alphabets entered by the user. Use function to display it.
#include<iostream>
using namespace std;
int main() {
char input;
for(int counter = 0; counter < 10; counter++) {
cout<<"Enter a symbol: ";
cin>>input;
}
return 0;
QUESTION 1
Modify the given program so that the program is able to calculate and display the number of male and female employees. Use a function name displayGender() to display counter number of gender.
#include<iostream>
using namespace std;
int main() {
char name[30];
char gender;
for(int counter = 0; counter < 5; counter++) {
cout<<"Name of the employee: ";
cin>>ws;
cin.getline(name, 30);
cout<<"Gender of the employee (M / F): "; cin>>gender;
}
return 0;
}
1: write a program to read numbers from a file.
2: Write a program to read string from a file.
Write a template function that returns the average of all the elements of an array. The arguments to the function should be the array name and the size of the array (type int). In main(), exercise the function with arrays of type int, long, double, and char.
Prepare a C++ program that implements modular programming and value returning function to solve the following problem.
Melur Spa and Beauty is an agency that provides service for facial and body treatments with reasonable package and price. The service provided as in Table 1. The table contains Treatment , Package , Price in Ringgit Malaysia (RM).
Table 1:
Treatment 1 - Body
Package and Price for treatment 1 - Massage (RM120) , Scrub (RM150).
Treatment 2 - Facial
Package and Price for treatment 2 - Refreshing (RM80) , Hydra Facial (RM100).
Customer can choose any package and treatment provided in the menu and your program can calculates the price need to be paid by the customer. 10% discount will be given if the total price is RM200 and above whereas 5% discount will be given if the total price is more than RM150. Total price and discount should be calculated in value returning function. Then, your program will display the total price, the discount rate and the nett price paid by the customer.