1. Draw the Flowchart and Write the Program to Calculate the Area of 15 Rooms. the Length

Total Page:16

File Type:pdf, Size:1020Kb

1. Draw the Flowchart and Write the Program to Calculate the Area of 15 Rooms. the Length

1. Draw the Flowchart and write the program to calculate the area of 15 rooms. The length is 55.2meters, and breadth is 26.34meters.

Flowchart

Program #include using namespace std; int main() { double length,breadth,area; length=55.2; breadth=26.34; area=15.0*55.2*26.34; cout<<”Area of 15 Rectangle Room is”<

2. You have been given a job as a programmer on a Software company. In order to accomplish some calculations, you need to know how many bytes the following data types use: char, int, float and double. You do not have manuals, so you can’t look this information up. Write a C++ program that will determine the amount of memory used by these types and display the information on the screen.

#include using namespace std; int main() { cout<<”The size of int data type is”<

Algorithm Step 1: Start Step 2: Set petrol=60,distance=350 Step 3: Calcultae MPL=distance/petrol Step 4: Print MPL Step 5: Stop

Program #include using namespace std; int main() { float distance=350.0,petrol=60.0,MPL; MPL=distance/petrol; cout<<”The Miles Per Litter of Car is”<

4.Write the algorithm and C++ program to convert from inches to meters Hint: 1 inch = 0.0254 meters

Algorithm Start Step 1: Read inches Step 2: meters=0.0254*inches Step 3: Display the meters Stop

Program #include using namespace std; int main() { double inches,meters; cout<<”Enter the values in inches”<>inches; meters=0.0254*inches; cout<<”Value in meters is”<

Algorithm Step 1: Start Step 2: Set MPLtown=21.5, MPLhway=26.8, petrol=20 Step 3: Calculate distancet=petrol*MPLtown Step 4: Calculate distanceh=petrol*MPLhway Step 5: Print the distancet Step 6: Print the distanceh Step 7: Stop

Program #include using namespace std; int main() { float MPLtown=21.5f,MPLhway=26.8f,petrol=20.0f,distancet,distanceh; distancet=petrol*MPLtown; distanceh=petrol*MPLhway; cout<<"The Distance in Town is"<

6..Modify the following program so it prints two blank lines between each lines of text. #include using namespace std; int main() { cout<<"Two mandolins like creatures in the"; cout<<"dark"; cout<<"Creating the agony of ecstasy."; cout<<" - George Barker"; return(0); }

Answer #include using namespace std; int main() { cout<<"Two mandolins like creatures in the\n\n\n"; cout<<"dark\n\n\n"; cout<<"Creating the agony of ecstasy.\n\n\n"; cout<<" - George Barker"; return(0); } \

8. Draw the flowchart and write the C++ program to calculate the pay of employee (for one day) based on the hour basis. Hint: pay= Amount Per Hour*Number of Hours Worked

Flowchart

Program #include using namespace std; int main() { float hours,amount,pay; cout<<”Enter the value for hours”<>hours; cout<<”Enter the value for amount”<>amount; pay=amount*hours; cout<<”The pay of employee is”<

Recommended publications