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

Looking For Something at vustudents.ning.com? Click Here to Search

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

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

+ How to Follow the New Added Discussions at Your Mail Address?

+ 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?


See Your Saved Posts Timeline

Views: 2055

.

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

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

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Attachments:

Replies to This Discussion

Error arha ha

Attachments:
jahan ap ny cin>> base1; likha ha ap base1 ki jga b1 likhen jo ap argument le rhy hn or same base2 ki jga b2 use kr k dekhen

Yes, ye jaan boj kar kya hai student ko tura bohat workout tu karna hota hai.

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.

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";
cout "\n\nEnter your choice: ";
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) );
}

thanks to give the sollution

is main error a rha hai

ye len is men koi error ni aa rha

Attachments:

#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;

cout"Enter your choice: ";
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");
}

RSS

Today Top Members 

© 2020   Created by +M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.