عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 26-12-2009, 09:55 PM   #6

Mr.Ahmad

عضو هيئة تدريس

الصورة الرمزية Mr.Ahmad

 
تاريخ التسجيل: Jul 2008
كلية: كلية الحاسبات وتقنية المعلومات
التخصص: IT
نوع الدراسة: عضو هيئة تدريس
المستوى: متخرج
البلد: جــــدة
الجنس: ذكر
المشاركات: 2,477
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , واجبات , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

المشاركة الأصلية كتبت بواسطة زهرة البنفسج مشاهدة المشاركة
الحين عندنا و اجب برنامج إنه اي جملة بدخلها المستخدم إني أطلع الحروف الكبيرةو و الصغيرة و الأشياء الأخرى (فراغات و أرقام)و حروف العلة ..........بس لو سمحت يامستر أحمد إيش الغلط في الكود ده و ماني عارفة كيف أطلع حروف العلة........هل أدخل السويتش.....أرجو المساعدة...
كود:
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
#include<ctype>
 void main()
    {
        char string[100],cap[50],small[50],other[50],vowel[50];
        int i,l,c=0,s=0,o=0,v=0;
        cout<<"Enter any sentence: ";
        gets(string);
        l=strlen(string);
        for(i=0;i<=l;i++)
          {
             if ((string[i]>='A')&&(string[i]<='Z'))
            {
              cap[i]=string[i];
              c++;
            }
             else if ((string[i]>='a')&&(string[i]<='z'))
                   {
                     small[i]=string[i];
                     s++;
                   }
                  else
                       {
                         other[i]=string[i];
                         o++;
                       }
          }
         cout<<"The capital letters : "<<cap<<"\n the number is: "<<c;
         cout<<"\nThe small letters:"<<small<<"\n the number is: "<<s;
         cout<<"\nOthers"<<other<<"\n the number is: "<<o;
         cout<<"\nThe vowel letters:"<<vowel<<"\n the number is: "<<v;
         getch();
    }
المشاركة الأصلية كتبت بواسطة زهرة البنفسج مشاهدة المشاركة
معليش أناعرفت المتغير vowel عشان أستخدمه في حروف العلة
المشاركة الأصلية كتبت بواسطة زهرة البنفسج مشاهدة المشاركة
لو سمحتو ساعدوني بسرعة..................مررررررررررة محتاجة
حلي :
كود:
#include <iostream.h> #include <conio.h> #include <string.h> #include <stdio.h> #include <ctype> void main() { char txt[100],cCap[100],cSml[100],cOth[100],cVow[100]; int i,iLen = 0,iCap = 0,iSml = 0,iOth = 0,iVow = 0; cout << "Please Enter : " ; gets(txt); iLen = strlen(txt); for (i=0; i < iLen; i++)  { //Cap if ( (txt[i] >= 'A') && (txt[i] <= 'Z') ) { //Vol if ( (txt[i] == 'A') || (txt[i] == 'E') || (txt[i] == 'I') || (txt[i] == 'O') || (txt[i] == 'U') ) { cVow[iVow] = txt[i]; iVow++; } cCap[iCap] = txt[i]; iCap++; } //Sml else if ( (txt[i] >= 'a') && (txt[i] <= 'z') ) { //Vol if ( (txt[i] == 'a') || (txt[i] == 'e') || (txt[i] == 'i') || (txt[i] == 'o') || (txt[i] == 'u') ) { cVow[iVow] = txt[i]; iVow++; } cSml[iSml] = txt[i]; iSml++; } //Oth else { cOth[iOth] = txt[i]; iOth++; } } cout << endl; //print Cap if (iCap != 0) { cout << "The capital letters :\n"; for (i=0; i < iCap; i++) cout << cCap[i] << " "; cout << endl; cout << "the number is: " << iCap << endl; } else cout <<"There are no capital letters! \n"; cout << endl; //print Sml if (iSml != 0) { cout << "The small letters :\n"; for (i=0; i < iSml; i++) cout << cSml[i] << " "; cout << endl; cout << "the number is: " << iSml << endl; } else cout <<"There are no small letters! \n"; cout << endl; //print Oth if (iOth != 0) { cout << "The other letters :\n"; for (i=0; i < iOth; i++) if (cOth[i] == ' ') cout << "Space "; else cout << cOth[i] << " "; cout << endl; cout << "the number is: " << iOth << endl; } else cout <<"There are no other letters! \n"; cout << endl; //print Vow if (iVow != 0) { cout << "The vowels letters :\n"; for (i=0; i < iVow; i++) cout << cVow[i] << " "; cout << endl; cout << "the number is: " << iVow << endl; } else cout <<"There are no vowels letters! \n"; cout << endl; getch(); }

 

توقيع Mr.Ahmad  

 

سبحان الله وبحمد ,,, سبحان الله العظيم
الحمد لله كما ينبغي لجلال وجهه وعظيم سلطانه .
اللهم صل على محمد وعلى آل محمد كما صليت على إبراهيم وعلى آل إبراهيم إنك حميد مجيد . اللهم بارك على محمد وعلى آل محمد كما باركت على إبراهيم وعلى آل إبراهيم إنك حميد مجيد.

 

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