InstagramTwitterSnapChat


 
وصف

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


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

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

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

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

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 غير متواجد حالياً   رد مع اقتباس
 

 


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

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

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

 


الساعة الآن 03:06 AM


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-2024