المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : لوسمحتوا ابي مساعده ضروي



قشاطي
24-12-2009, 09:39 PM
Write an application that input three integers from the user and display the sum;
Average product and smaller and largest of the numbers, use the techniques shown in fig. 3.18[Note: the calculation of the average in this exercise should result in an integer representation of the average. So, if the sum of the values is 7, the average should be 2, not 2.3333…]

The output must like the following

Enter first integer: 10
Enter second integer: 20
Enter third integer: 30
For the numbers 10, 20 and 30
Largest is 30
Smallest is 10
Sum is 60
Product is 6000
Average is 20




Enter first integer:200
Enter second integer: 300
Enter third integer: 100
For the numbers 200, 300 and 100
Largest is 300
Smallest is 100
Sum is 600
Product is 6000000
Average is 200

Q2) Create a class called date that includes three pieces of information as automatic properties (a month (type int), a day (type int). Your class should have a constructor that initializes the three automatic properties and assumes that the values provided are correct
Provided a method DisplayDate that display the month, day and year separated by forward slashes (/). Write a test application named DateTest that demor.strates class Date's capabilities.

The output must like the following.

The initial date is: 7/4/2004
Data with new values is: 11/1/2003

Q3) Crate class rectangle. The class has attributes length and width, each of which defaults to 1. It has red –only properties that calculate the perimeter and the area of the rectangle. It has properties for XXXX length and width. The set accessors should verify tat length and width are each floating-point numbers greater than0.0 and less than 20.0. Write an application to test class rectangle.

The output must like the following.

Set length
Set width
Exit

Choice: 1
Enter length: 10
Length: 10
Width: 1

Perimeter: 22
Area: 10
Set length
Set width
Exit


Choice: 2
Enter length: 15
Length: 10
Width: 15



Perimeter: 50
Area: 150
Set length
Set width
Exit

لوسمحتوا ممكن حد يساعدني في حل هالاسايمنت الانه الاستاذ عطنا يومين بس عشان نحله وكل واحد بروحه
هو الحل بيكون بلغة السي شارب ارجوكم ضروري اللي يعرف الحل يساعدني بليز

mulhafa1990
27-12-2009, 10:43 PM
هذا جواب ال largest بس
#include<iostream>
using namespace std;
void main()
{
int a,b,c;
cout<<"Enter first integer:"<<endl;
cin>>a;
cout<<"Enter second integer:"<<endl;
cib>>b;
cout<<"Enter first integer:"<<endl;
cout<<"Enter third integer:"<<endl;
cin>>c;
if (a>=b+c)
else if (b>=a+c)
cout<<"Largest is "<<b<<endl;
else if( c>=a+b)

cout<<"Largest is "<<c<<endl;

}