0% found this document useful (0 votes)
28 views

Assignment1 PDF

This C++ program calculates the area and volume of a 3D shape. It prompts the user to input the base, width, and height, then uses those values in formulas to calculate the area (0.5 * base * width) and volume (base * width * height). It outputs the calculated area and volume values.

Uploaded by

Afiq Munchyz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Assignment1 PDF

This C++ program calculates the area and volume of a 3D shape. It prompts the user to input the base, width, and height, then uses those values in formulas to calculate the area (0.5 * base * width) and volume (base * width * height). It outputs the calculated area and volume values.

Uploaded by

Afiq Munchyz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1: /*************************************************

2: Name    : Syafiq
3: Date    : 21 March 2018
4: Group   : RAP2204C
5: Title   : Calculation for Area and Volume
6: *************************************************/
7: 
8: #include<iostream>
9: using namespace std;
10: int main()
11: 
12: {
13: double base, width, height, volume, area;
14: 
15: //input
16: cout<<"Enter base:";
17: cin>>base;
18: cout<<"Enter width:";
19: cin>>width;
20: cout<<"Enter height:";
21: cin>>height;
22: 
23: //process
24: area=0.5*base*width;
25: volume=base*width*height;
26: 
27: //output
28: cout<<"\n Your Area = "<<area;
29: cout<<"\n Your Volume = "<<volume;
30: 
31: return 0;
32: }
33: 

You might also like