InstagramTwitterSnapChat


 
وصف

العودة   منتديات سكاو > الكليات الجامعية > منتدى كلية الحاسبات وتقنية المعلومات > المنتدى العام لكلية الحاسبات وتقنية المعلومات
التسجيل مشاركات اليوم البحث
   
   


المنتدى العام لكلية الحاسبات وتقنية المعلومات قسم خاص بالمواد العامة و الطلاب غير المتخصصين بكلية الحاسبات وتقنية المعلومات

[cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

المنتدى العام لكلية الحاسبات وتقنية المعلومات

إضافة رد
 
أدوات الموضوع إبحث في الموضوع انواع عرض الموضوع
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 25-11-2010, 05:53 PM   #911

sil--ver

جامعي

الصورة الرمزية sil--ver

 
تاريخ التسجيل: Jul 2009
التخصص: IT ^.^
نوع الدراسة: إنتظام
المستوى: السادس
الجنس: ذكر
المشاركات: 137
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

المشاركة الأصلية كتبت بواسطة بسمة ألـم مشاهدة المشاركة
ودا حل فقره 5


#include<conio.h>
#include<math.h>
int main(void)
{
double x,y,z;
int a,b,c;
char d;
do
{
printf("Enter first num");
scanf("%lf",&x);
printf("Enter second num");
scanf("%lf",&y);
printf("Enter the operation +,-,*,/\n");
scanf("%c",&d);
switch(d)
{
case '+':z=x+y;
printf("%f+%f=%f",x,y,z);
break;
case '-':z=x-y;
printf("%f-%f=%f",x,y,z);
break;
case '*':z=x*y;
printf("%f*%f=%f",x,y,z);
break;
case '/':
if(y==0){
printf("cann't calculate");}
else
{z=x/y;
printf("%f/%f=%f",x,y,z);}
break;
case '%': z= (a)%(b);


printf("%d % %d= %f",a,b,z);
break;
default:printf("cann't calculate");
break;
}
printf("\nto calculate press 1\n");
scanf("%d",&c);
}while(c==1);

getch();
}


ودا رقم 6


#include<stdio.h>
#include<conio.h>
#include<math.h>
int main(void)
{
double x,y,z;
int a,b,c;
char d;
while(c==1);
printf("Enter first num");
scanf("%lf",&x);
printf("Enter second num");
scanf("%lf",&y);
printf("Enter the operation +,-,*,/\n");
scanf("%c",&d);
switch(d)
{
case '+':z=x+y;
printf("%f+%f=%f",x,y,z);
break;
case '-':z=x-y;
printf("%f-%f=%f",x,y,z);
break;
case '*':z=x*y;
printf("%f*%f=%f",x,y,z);
break;
case '/':
if(y==0){
printf("cann't calculate");}
else
{z=x/y;
printf("%f/%f=%f",x,y,z);}
break;
case '%': z= (a)%(b);


printf("%d % %d= %f",a,b,z);
break;
default:printf("cann't calculate");
break;
}
printf("\nto calculate press 1\n");
scanf("%d",&c);


getch();
}


بلييييييز ماعاد فيه وقت صححولي
اتمنى يكون صح


كود:
#include <stdio.h>
#include<conio.h>
#include<math.h>
int main(void)
{
double x,y,z;
int a=0,b=0,c;
char d;
do
{
printf("Enter first num");
scanf("%lf",&x);
printf("Enter second num");
scanf("%lf",&y);
printf("Enter the operation +,-,*,/\n");
scanf(" %c",&d);
switch(d)
{
case '+':z=x+y;
printf("%f+%f=%f",x,y,z);
break;
case '-':z=x-y;
printf("%f-%f=%f",x,y,z);
break;
case '*':z=x*y;
printf("%f*%f=%f",x,y,z);
break;
case '/':
if(y==0){
printf("cann't calculate");}
else
{z=x/y;
printf("%f/%f=%f",x,y,z);}
break;
case '%':
a=x;
b=y;
z= a%b;
printf("%d mod(%d)= %f",a,b,z);
break;
default:printf("cann't calculate");
break;
}
printf("\nto calculate press 1\n");
scanf("%d",&c);
}while(c==1);

getch();
}

 

توقيع sil--ver  

 

بسم الله الرحمن الرحيم


رأيت العلم صاحبه كريمٌ......ولو ولدته آباءُ لئِـامُ
وليس يزال يرفعه إلى أن......يُعظم أمره القوم الكرامُ
ويتبعونه في كل حالٍ......كراعي الضأن تتبعه السوام
فلولا العلم ماسعدت رجال......ولاعُرِف الحلال ولا الحرامُ


 


التعديل الأخير تم بواسطة sil--ver ; 25-11-2010 الساعة 05:55 PM.
sil--ver غير متواجد حالياً   رد مع اقتباس
 

منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 25-11-2010, 06:04 PM   #912

NaSeM

OpTiMiSTiC G!rL

الصورة الرمزية NaSeM

 
تاريخ التسجيل: Dec 2009
نوع الدراسة: إنتظام
المستوى: الثالث
الجنس: أنثى
المشاركات: 265
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

كود:
#include<stdio.h>
#include<conio.h>
void main ()
{
	char x,y;
	double l=0,w=0,h=0,r=0,s=0;
      printf("Enter:\na for circumference or b for area\n");
	   scanf("%c",&x);
      printf("Enter:\n    s for Square\n or r for rectangle\n or c for Circle\n or t FOR Tringle\n");
	   scanf("%c",&y);

	     switch(x)
    {
		 case 'a':
       {
		    if (y=='s'||y=='S')
          {
				printf("enter l for length\n");
			    scanf("%lf",&l);
				printf("the area of square is equal to ( %f )",l*l);
           }
			else if (y=='r'||y=='R')
          {
				printf("enter w for width and h height for\n ");
			    scanf("%lf %lf",&h,&w);
				printf("the area of Rectangle is equal to ( %f )",w*h);
           }
			else if (y=='c'||y=='C')
           {
				printf("enter r for radius\n ");
				scanf("%lf",&r);
				printf("the area of circle is equal to ( %f )",3.14*r*r);
           }
			else if (y=='t'||y=='T')
          {
				printf("enter h for vertical height and s for base\n ");
				scanf("%lf%lf",&h,&s);
				printf("the area of circle is equal to ( %f )",.5*s*h);
           }
			else
          {
				printf("error choice,try again");
          }
      }
		break;

		 case 'b':
       {
		    if (y=='s'||y=='S')
          {
				printf("enter l for length\n");
			    scanf("%lf",&l);
				printf("the circumference of square is equal to ( %f )",4*l);
           }
			else if (y=='r'||y=='R')
           {
				printf("enter the two sides h and w\n ");
				scanf("%lf %lf",&h,&w);
				printf("the circumference of Rectangle is equal to ( %f )",2*w*2*h);
           }
			else if (y=='c'||y=='C')
           {
				printf("enter r for radius\n ");
				scanf("%lf",&r);
				printf("the circumference of circle is equal to ( %f )",2*3.14*r);
           }
			else if (y=='t'||y=='T')
           {
				printf("enter the three sides h , s and w\n ");
				scanf("%lf%lf%lf",&h,&s,&w);
				printf("the circumference of circle is equal to ( %f )",h+s+w);
            }
			else
            {
				printf("error choice,try again");
            }
        }
	    break;

		 default : printf("error choice,try again");
 	}
getch();
}
إيش الخطأ اللي عندي ؟؟
لمن اسوي رن ادخل الخيار الاول وبعدها لمن اجي ادخل الخيار الثاني يروح على طول عا (defalt ( error choice بدون مايسوي العمليات والمفروض مايروح للـerror choice !!!!!!??

 


التعديل الأخير تم بواسطة NaSeM ; 25-11-2010 الساعة 06:08 PM.
NaSeM غير متواجد حالياً   رد مع اقتباس
 

منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 25-11-2010, 06:12 PM   #913

sil--ver

جامعي

الصورة الرمزية sil--ver

 
تاريخ التسجيل: Jul 2009
التخصص: IT ^.^
نوع الدراسة: إنتظام
المستوى: السادس
الجنس: ذكر
المشاركات: 137
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

المشاركة الأصلية كتبت بواسطة NaSeM مشاهدة المشاركة
كود:
#include<stdio.h>
#include<conio.h>
void main ()
{
	char x,y;
	double l=0,w=0,h=0,r=0,s=0;
      printf("Enter:\na for circumference or b for area\n");
	   scanf("%c",&x);
      printf("Enter:\n    s for Square\n or r for rectangle\n or c for Circle\n or t FOR Tringle\n");
	   scanf("%c",&y);

	     switch(x)
    {
		 case 'a':
       {
		    if (y=='s'||y=='S')
          {
				printf("enter l for length\n");
			    scanf("%lf",&l);
				printf("the area of square is equal to ( %f )",l*l);
           }
			else if (y=='r'||y=='R')
          {
				printf("enter w for width and h height for\n ");
			    scanf("%lf %lf",&h,&w);
				printf("the area of Rectangle is equal to ( %f )",w*h);
           }
			else if (y=='c'||y=='C')
           {
				printf("enter r for radius\n ");
				scanf("%lf",&r);
				printf("the area of circle is equal to ( %f )",3.14*r*r);
           }
			else if (y=='t'||y=='T')
          {
				printf("enter h for vertical height and s for base\n ");
				scanf("%lf%lf",&h,&s);
				printf("the area of circle is equal to ( %f )",.5*s*h);
           }
			else
          {
				printf("error choice,try again");
          }
      }
		break;

		 case 'b':
       {
		    if (y=='s'||y=='S')
          {
				printf("enter l for length\n");
			    scanf("%lf",&l);
				printf("the circumference of square is equal to ( %f )",4*l);
           }
			else if (y=='r'||y=='R')
           {
				printf("enter the two sides h and w\n ");
				scanf("%lf %lf",&h,&w);
				printf("the circumference of Rectangle is equal to ( %f )",2*w*2*h);
           }
			else if (y=='c'||y=='C')
           {
				printf("enter r for radius\n ");
				scanf("%lf",&r);
				printf("the circumference of circle is equal to ( %f )",2*3.14*r);
           }
			else if (y=='t'||y=='T')
           {
				printf("enter the three sides h , s and w\n ");
				scanf("%lf%lf%lf",&h,&s,&w);
				printf("the circumference of circle is equal to ( %f )",h+s+w);
            }
			else
            {
				printf("error choice,try again");
            }
        }
	    break;

		 default : printf("error choice,try again");
 	}
getch();
}
إيش الخطأ اللي عندي ؟؟
لمن اسوي رن ادخل الخيار الاول وبعدها لمن اجي ادخل الخيار الثاني يروح على طول عا (defalt ( error choice بدون مايسوي العمليات والمفروض مايروح للـerror choice !!!!!!??

الكود صح بس لام نضع مسافة في " %c"
كود:
#include<stdio.h>
#include<conio.h>
void main ()
{
	char x,y;
	double l=0,w=0,h=0,r=0,s=0;
      printf("Enter:\n a for circumference or b for area\n");
	   scanf(" %c",&x);
      printf("Enter:\n    s for Square\n or r for rectangle\n or c for Circle\n or t FOR Tringle\n");
	   scanf(" %c",&y);

	     switch(x)
    {
		 case 'a':
       {
		    if (y=='s'||y=='S')
          {
				printf("enter l for length\n");
			    scanf("%lf",&l);
				printf("the area of square is equal to ( %f )",l*l);
           }
			else if (y=='r'||y=='R')
          {
				printf("enter w for width and h height for\n ");
			    scanf("%lf %lf",&h,&w);
				printf("the area of Rectangle is equal to ( %f )",w*h);
           }
			else if (y=='c'||y=='C')
           {
				printf("enter r for radius\n ");
				scanf("%lf",&r);
				printf("the area of circle is equal to ( %f )",3.14*r*r);
           }
			else if (y=='t'||y=='T')
          {
				printf("enter h for vertical height and s for base\n ");
				scanf("%lf%lf",&h,&s);
				printf("the area of circle is equal to ( %f )",.5*s*h);
           }
			else
          {
				printf("error choice,try again");
          }
      }
		break;

		 case 'b':
       {
		    if (y=='s'||y=='S')
          {
				printf("enter l for length\n");
			    scanf("%lf",&l);
				printf("the circumference of square is equal to ( %f )",4*l);
           }
			else if (y=='r'||y=='R')
           {
				printf("enter the two sides h and w\n ");
				scanf("%lf %lf",&h,&w);
				printf("the circumference of Rectangle is equal to ( %f )",2*w*2*h);
           }
			else if (y=='c'||y=='C')
           {
				printf("enter r for radius\n ");
				scanf("%lf",&r);
				printf("the circumference of circle is equal to ( %f )",2*3.14*r);
           }
			else if (y=='t'||y=='T')
           {
				printf("enter the three sides h , s and w\n ");
				scanf("%lf%lf%lf",&h,&s,&w);
				printf("the circumference of circle is equal to ( %f )",h+s+w);
            }
			else
            {
				printf("error choice,try again");
            }
        }
	    break;

		 default : printf("error choice,try again");
 	}
getch();
}

 

sil--ver غير متواجد حالياً   رد مع اقتباس
 

منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 25-11-2010, 06:27 PM   #914

بسمة ألـم

حياااااااتي كلهـا لله

الصورة الرمزية بسمة ألـم

 
تاريخ التسجيل: Aug 2009
نوع الدراسة: إنتظام
المستوى: الثالث
الجنس: أنثى
المشاركات: 1,096
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

يعطيك العافيه اخوي سلفر ماقصدرت الله يجعله في ميزان حسسسسناااتك ياارب

بس فقره 5 مافهمت ليش سويت كدا

a=x;
b=y;
z= a%b;

ليش ماتركتها زي ماهيا x y

وفقره 6 هل هيا صحيحه؟

 

توقيع بسمة ألـم  

 

نقرتين لعرض الصورة في صفحة مستقلةنقرتين لعرض الصورة في صفحة مستقلةنقرتين لعرض الصورة في صفحة مستقلةنقرتين لعرض الصورة في صفحة مستقلة

[c=14]- [c=1]توأمي[/c] اطيب قلب واجهته وـأجمل وجه قابلته عسآنـي مانحرم منك طول العمر..! [c=1]![/c][/c]

 

بسمة ألـم غير متواجد حالياً   رد مع اقتباس
 

منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 25-11-2010, 06:34 PM   #915

sil--ver

جامعي

الصورة الرمزية sil--ver

 
تاريخ التسجيل: Jul 2009
التخصص: IT ^.^
نوع الدراسة: إنتظام
المستوى: السادس
الجنس: ذكر
المشاركات: 137
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

المشاركة الأصلية كتبت بواسطة بسمة ألـم مشاهدة المشاركة
يعطيك العافيه اخوي سلفر ماقصدرت الله يجعله في ميزان حسسسسناااتك ياارب

بس فقره 5 مافهمت ليش سويت كدا

a=x;
b=y;
z= a%b;

ليش ماتركتها زي ماهيا x y
عشان نحول من double إلى int


وفقره 6 هل هيا صحيحه؟
وفقرة 6 هي نفسه فقرة 5

وبالتوفيق

 

sil--ver غير متواجد حالياً   رد مع اقتباس
 

منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 25-11-2010, 06:46 PM   #916

بسمة ألـم

حياااااااتي كلهـا لله

الصورة الرمزية بسمة ألـم

 
تاريخ التسجيل: Aug 2009
نوع الدراسة: إنتظام
المستوى: الثالث
الجنس: أنثى
المشاركات: 1,096
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

المشاركة الأصلية كتبت بواسطة sil--ver مشاهدة المشاركة
وفقرة 6 هي نفسه فقرة 5

وبالتوفيق

اها

ما اقدر احط كلمه انتقر قبلها واريح راسي

وفقره 6 مطلوب while مو do while كيف نفسها

 

بسمة ألـم غير متواجد حالياً   رد مع اقتباس
 

منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 25-11-2010, 09:18 PM   #917

NaSeM

OpTiMiSTiC G!rL

الصورة الرمزية NaSeM

 
تاريخ التسجيل: Dec 2009
نوع الدراسة: إنتظام
المستوى: الثالث
الجنس: أنثى
المشاركات: 265
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

جزاك الله الف خير
فعلا هوا سبب الخطأ اللي عندي

 

NaSeM غير متواجد حالياً   رد مع اقتباس
 

منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 25-11-2010, 10:20 PM   #918

رحاب 09

جامعي

 
تاريخ التسجيل: Jul 2010
التخصص: ^^ لسة
نوع الدراسة: إنتظام
المستوى: الثالث
الجنس: أنثى
المشاركات: 206
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

كود:
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main ()
{
char shape,required  ;
int h, x , y , radius , l , w ,b;

{
 printf("traingle\ncircle\nrectangle");
 printf("enter your choic");
 scanf("%c",&shape);
}
{
 printf("area\nvicinity");
 printf("enter your choic");
 scanf("%c",&required);
 }
 switch(shape)
 {
 case 't':
 case 'T':

 if( required == 'a'|| required =='A')
 {
 printf("enter the base and the height");
 scanf("%d%d",&b,&h);
 printf(" the area of the traingle is =  %d ",1/2*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 'c':
 case 'C':

  if(required == 'a' || required == 'A')
  {
  printf("enter the radius of the circle");
  scanf("%d",&radius);
  printf("the area of the circle = %d",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 = %d",2*3.14*radius);
  {
  break;

  case 'r':
  case 'R':
  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();
  }                    
السلام عليكم :)

يقول لي البرنامج ان الاخطاء في الأقواس .. !

ما الخطأ جزاكم الله خيراً :)

وهل في احد عندو برنامج بسيط بالـ loop ؟ اقدر امشي على نفس خطواته

شكراً جزيلاً


موفقين

 

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

منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 26-11-2010, 12:59 AM   #919

sil--ver

جامعي

الصورة الرمزية sil--ver

 
تاريخ التسجيل: Jul 2009
التخصص: IT ^.^
نوع الدراسة: إنتظام
المستوى: السادس
الجنس: ذكر
المشاركات: 137
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

المشاركة الأصلية كتبت بواسطة بسمة ألـم مشاهدة المشاركة
اها

ما اقدر احط كلمه انتقر قبلها واريح راسي

وفقره 6 مطلوب while مو do while كيف نفسها

اقصد نفس الفكرة
كود:
#include<stdio.h>
int main()
{
double x,y,z;
int a,b,c=1;
char d;

while(c==1)
{
printf("Enter first num");
scanf("%lf",&x);
printf("Enter second num");
scanf("%lf",&y);
printf("Enter the operation +,-,*,/\n");
scanf(" %c",&d);
switch(d)
{
case '+':z=x+y;
printf("%f+%f=%f",x,y,z);
break;
case '-':z=x-y;
printf("%f-%f=%f",x,y,z);
break;
case '*':z=x*y;
printf("%f*%f=%f",x,y,z);
break;
case '/':
if(y==0){
printf("cann't calculate");}
else
{z=x/y;
printf("%f/%f=%f",x,y,z);}
break;
case '%':
	{a=x;
	b=y;
	z= (a)%(b);


	printf("%d mod(%d)= %f",a,b,z);}
break;
default:{printf("cann't calculate");}
break;
}
printf("\nto calculate press 1\n");
scanf("%d",&c);
}
return(0);}

 

sil--ver غير متواجد حالياً   رد مع اقتباس
 

منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 26-11-2010, 01:39 AM   #920

sil--ver

جامعي

الصورة الرمزية sil--ver

 
تاريخ التسجيل: Jul 2009
التخصص: IT ^.^
نوع الدراسة: إنتظام
المستوى: السادس
الجنس: ذكر
المشاركات: 137
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

المشاركة الأصلية كتبت بواسطة رحاب 09 مشاهدة المشاركة
كود:
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main ()
{
char shape,required  ;
int h, x , y , radius , l , w ,b;

{
 printf("traingle\ncircle\nrectangle");
 printf("enter your choic");
 scanf("%c",&shape);
}
{
 printf("area\nvicinity");
 printf("enter your choic");
 scanf("%c",&required);
 }
 switch(shape)
 {
 case 't':
 case 'T':

 if( required == 'a'|| required =='A')
 {
 printf("enter the base and the height");
 scanf("%d%d",&b,&h);
 printf(" the area of the traingle is =  %d ",1/2*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 'c':
 case 'C':

  if(required == 'a' || required == 'A')
  {
  printf("enter the radius of the circle");
  scanf("%d",&radius);
  printf("the area of the circle = %d",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 = %d",2*3.14*radius);
  {
  break;

  case 'r':
  case 'R':
  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();
  }                    
السلام عليكم :)

يقول لي البرنامج ان الاخطاء في الأقواس .. !

ما الخطأ جزاكم الله خيراً :)

وهل في احد عندو برنامج بسيط بالـ loop ؟ اقدر امشي على نفس خطواته

شكراً جزيلاً


موفقين
أتمنى يكون صحيح

تفضلي
كود:
#include <stdio.h>
#include <math.h>
int main ()
{
char shape,required  ;
int h, x , y , radius , l , w ,b;
 printf("traingle\ncircle\nrectangle\n");
 printf("enter your choic");
 scanf(" %c",&shape);

 printf("area\nvicinity\n");
 printf("enter your choic");
 scanf(" %c",&required);
 
 switch(shape)
 {
 case 't':
 case 'T':

 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 'c':
 case 'C':

  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 'r':
  case 'R':
  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");
  }
 }
   return(0);
  }

 

sil--ver غير متواجد حالياً   رد مع اقتباس
 

إضافة رد


تعليمات المشاركة
لا تستطيع إضافة مواضيع جديدة
لا تستطيع الرد على المواضيع
لا تستطيع إرفاق ملفات
لا تستطيع تعديل مشاركاتك

BB code is متاحة
كود [IMG] متاحة
كود HTML معطلة

الانتقال السريع

 


الساعة الآن 12:55 PM


Powered by vBulletin® Version 3.8.9 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Ads Organizer 3.0.3 by Analytics - Distance Education

أن كل ما ينشر في المنتدى لا يمثل رأي الإدارة وانما يمثل رأي أصحابها

جميع الحقوق محفوظة لشبكة سكاو

2003-2023