عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
  #1  
قديم 03-12-2010, 05:26 PM

رحاب 09 رحاب 09 غير متواجد حالياً

جامعي

 
تاريخ التسجيل: Jul 2010
التخصص: ^^ لسة
نوع الدراسة: إنتظام
المستوى: الثالث
الجنس: أنثى
المشاركات: 206
افتراضي طلب لو تكرمتم .. برمجه 202


السلام عليكم ورحمة الله وبركاته


عندي هذا البرنامج .. عملته بإستخدام الـ switch والبرنامج صحيح وشغال 100%


كود:
#include <stdio.h>
#include <math.h>
#include <conio.h>
int main ()
{
char required  ;
int h, x , y , radius , l , w ,b, shape ;
 printf("traingle<1>\ncircle<2>\nrectangle<3>\n");
 printf("enter your choic");
 scanf(" %c",&shape);
 printf("area\nvicinity\n");
 printf("enter your choic");
 scanf(" %c",&required);
 switch(shape)
 {
 case '1':
 if( required == 'a'|| required =='A')
 {
 printf("enter the base and the height");
 scanf("%d%d",&b,&h);
 printf(" the area of the traingle is =  %f ",(0.5*b*h));
 }
 else if( required == 'v' || required == 'V')
 {
 printf("enter the lenght of the traingle side");
 scanf("%d%d",&x,&y);
 printf("the vicinity of the trainfle is = %d",(x+y));
 }
 break;
 case '2':
  if(required == 'a' || required == 'A')
  {
  printf("enter the radius of the circle");
  scanf("%d",&radius);
  printf("the area of the circle = %f",((pow(radius,2))* 3.14));
  }
  else if (( required == 'v' )|| ( required == 'V'))
  {
  printf("enter the radius of the circle");
  scanf("%d",&radius);
  printf("the vicinity of the circle = %f",2*3.14*radius);
  }
  break;
  case '3':
  if(( required == 'a' )||( required == 'A'))
  {
  printf(" enter the lenghth and the width");
  scanf("%d%d",&l,&w);
  printf(" the area of the rectangle = %d",l*w);
  }
  else if (( required == 'v' )|| ( required == 'V'))
  {
  printf("enter the lenght and the width");
  scanf("%d%d",&l,&w);
  printf("the vicinity of the rectangle = %d",(l+w)*2);
  }
  break;
  default:
  {
  printf("Wrong choice.Try again");
  }
 }
  getch();
   return(0);
  }


أحتاج دحين إني أعمله بالـ loop بأي شكل من أشكالها
while او do while

أحد يقدر يشرح ليي أيش المفروض أسوي ؟
الكنترول فاريبل من عندي ولا هو واحد من المتغيرات الموجوده ؟
شرط اللوب ؟
كيف يتغير ذاخل البرنامج ؟


شكراً جزيلاً مقدماً :)

جمعة مباركة :")
رد مع اقتباس