24-05-2010, 09:10 PM
|
#7
|
تاريخ التسجيل: Sep 2009
التخصص: IT
نوع الدراسة: إنتظام
المستوى: الخامس
الجنس: أنثى
المشاركات: 1,200
|
رد: آخر واجب حاسب هالترم ..فرجاء لاتبخلو عليآ..
::
هذا التعديل .. والمعذرة زحمة اختبارات وتكاليف :(
if statment & switch لها نفس الاستخدام بس أحس السويتش مرنه أكثر عشان كذا حبيتها
السؤال الأول:
كود:
#include <iostream.h>
#include <conio.h>
void main()
{
float x,y;
char ch;
cout<<" Enter the first number : ";
cin>>x;
cout<<"\n Enter the operator : ";
cin>>ch;
cout<<"\n Enter the scend number : ";
cin>>y;
if (ch=='*')
cout<<" \n Answer = "<<(x*y);
else if (ch=='/')
cout<<" \n Answer = "<<(x/y);
else if (ch=='+')
cout<<" \n Answer = "<<(x+y);
else if (ch=='-')
cout<<" \n Answer = "<<(x-y);
else cout<<"Error Enytry";
getch();
}
وهذا السؤال الثاني :
كود:
# include <iostream.h>
# include <conio.h>
void main(){
float f, c;
c=((f-32)*(5/9));
f= (c *(9/5)+ 32);
int x;
cout<<"choose 1 to to convert Fahrenheit to Celsius";
cout<<"\nOR 2 to convert Celsius to Fahrenheit"<<endl;
cin>>x;
if (x==1)
{ cout<<"\nEnter temperature in Fahrenheit :";
cin>>f;
cout<<"\nThe temperature in Celsius is: "<<c; }
else if (x==2)
{cout<<"\nEnter temperature in Celsius :";
cin>>c;
cout<<"\nThe temperature in Fahrenheit is:"<<f;}
else cout<<"Error Entry";
getch();
}
بالــتوفيــق..
|
|
.
ركّـز اهتمـامك على عمـل وآحـد..
وانغمـس فيه..واحتـرق به ..
واعـشقه لـ تكن مـبدعـًا ..
=)
|
|
|
|