We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

# cs201-Assignment # 1(Complete Solution)

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?

Views: 5045

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

Attachments:

### Replies to This Discussion

Dear Fellows,

All of you are requested, Please post Only One Discussion for Current Assignment/GDB/Online Quiz and everyone reply/share/discussed his/her data on that same discussion, so that all members get solution & discuss easily on Current Assignment/GDB/Online Quiz.

So please don’t post two or more discussions for one Current Assignment/GDB/Online Quiz, hope you’ll understand and cooperate with us.

http://vustudents.ning.com/group/cs201introductiontoprogramming/for...

My assignment solution please check if any error :)

Attachments:
cs201 correct solution

/*
BY Aamir Hafeez mc150400753@vu.edu.pk
remove the above type your name and roll no
This program will calculate the area of rectangle and trapezoid
*/
#include <iostream>
using namespace std;

double rectangleArea(double width, double length);
double trapezoidArea(double base1, double base2, double height);

main()
{
char c;

do{
int choice;
cout "\nEnter 1 to calculate area of rectangle\n";
cout "Enter 2 to calculate area of trapezoid\n";
cin >> choice;

if(choice == 1)
{
double width, length;
cout "Enter the width of rectangle: ";
cin >> width;
cout "Enter the length of rectangle: ";
cin >> length;
cout "The area of rectangle is: " rectangleArea(width, length);

}

else if(choice == 2)
{
double base1, base2, height;
cout "Enter the base1 of trapezoid: ";
cin >> base1;
cout "Enter the base2 of trapezoid: ";
cin >> base2;
cout "Enter the height of trapezoid: ";
cin >> height;
cout "\nThe area of trapezoid is: "
trapezoidArea(base1, base2, height);

}

cout "\n\nDo you want to do another calculation: ";
cin >> c;
} while( c == 'y' || c == 'Y');

return 0;
}

double rectangleArea(double width, double length)
{
return (width * length);
}

double trapezoidArea(double base1, double base2, double height)
{
return ( height *( (base1 + base2) / 2) );
}

lstn m not  getting error in  namespace em not getting it
the error is nested name specifier before name space
what is ths??

#include <iostream>
#include <stdlib.h>
using namespace std;

void AreaRect()
{
float x, y;
cout"\n\nEnter width of rectangle: ";
cin>>x;
cout"Enter length of rectangle: ";
cin>>y;
cout"The Area of rectangle is: "x*yendlendl;

}

float AreaTrap()
{
float base1, base2, height, tarea
cout"\nEnter base 1 of trapezoid: ";
cin>>base1;

cout"Enter base 1 of trapezoid: ";
cin>>base2;

cout"Enter height of trapezoid: ";
cin>>height;
tarea = ((base1+base2)/2)*height; // formula Area= ((b1 + b2)/2)*h
cout"\nThe Area of Trapezoid is: "tareaendlendl;
}

main() // functio to choice
{
int choice;
char repeat = 'y';
while(repeat=='y' || repeat=='Y')
{
cout"\n\nEnter 1 to calculate area of Rectangle"endl;

cout"Enter 2 to calculate area of Trapezoid\n"endl;

cin>>choice;

switch(choice)
{
case 1:
AreaRect();
break;

case 2:
AreaTrap();
break;
default:

cout"\nInvalid Choice!\n";
}
cout"Do you want another calculation?: ";
cin>>repeat;
}
system("pause");
}

please any body will help me to do cs201 assignment 1 due on 5

dec

## Latest Activity

Rahman Ullah posted a discussion

### CS302 Assignment No.3 Solution??

24 minutes ago
29 minutes ago
Rahman Ullah and norina joined + M.Tariq Malik's group

### CS302 Digital Logic Design

29 minutes ago
Rahman Ullah posted a status
"Koi CS302 Assignment No.3 Share karay"
36 minutes ago
47 minutes ago
48 minutes ago
+ ! ! Şĩɳℊℯℛ ⋆⭐️⋆ added a discussion to the group MGT101 Financial Accounting

54 minutes ago
55 minutes ago
55 minutes ago

### ECO404 Managerial Economics

56 minutes ago
+ ! ! Şĩɳℊℯℛ ⋆⭐️⋆ joined + M.Tariq Malik's group

57 minutes ago
1 hour ago

1

2

3