• 0
  • مالي خلق
  • أتهاوش
  • متضايق
  • مريض
  • مستانس
  • مستغرب
  • مشتط
  • أسولف
  • مغرم
  • معصب
  • منحرج
  • آكل
  • ابكي
  • ارقص
  • اصلي
  • استهبل
  • اضحك
  • اضحك  2
  • تعجبني
  • بضبطلك
  • رايق
  • زعلان
  • عبقري
  • نايم
  • طبيعي
  • كشخة
  • النتائج 1 إلى 6 من 6

    الموضوع: a function mneu_option() ..... مسألة في C++

    1. #1
      التسجيل
      04-11-2007
      المشاركات
      26
      المواضيع
      1
      شكر / اعجاب مشاركة

      Arrow a function mneu_option() ..... مسألة في C++

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

      عندي مسألة منغلقة شوي..

      هذي المسألة أتركها للأعضاء يعني

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

      Write a C++ program which calls a function mneu_option() that displays the following program menu:



      - The function should return the user choice to the program.
      -The program should keep displaying the menu until the user chooses to exit by selecting option 4.
      Each menu item would correspond to on of the following functions :
      (a) A void function prim_num(a,b), which lists all prime number between integers a,b (a prime number is the number that is divisible by 1 and by itself only).
      (b) A double function pi(n), which returns the value of approximated to n terms, where


      or :
      (c) A void function rev_order(k), which reverses the order of the digits of an integer number. The main program should print the integer number in a reverse order (ex: 57249 ---à 94275).

      (2) A void function Analysis(), which reads the contents of an input file and prints some analysis about the file contents in the following form :

      Number of lines :
      Number of capital letters :
      Number of small letters :
      Number of digits :
      Other symbols :

      (3) A bool function search(str), which gets some string from the program and searches this string for some word. The function should return true if the word is included in the string, false otherwise. If the searching was successful, the function should replace this word in the string with capital letters. The main program then prints the string after this replacement.

      وسلامتكم .. هذي المسألة اهداء خاصة ل
      UUNUU

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

      سأعود للنقاش في المسألة معكم



    2. #2
      التسجيل
      16-02-2007
      المشاركات
      298
      المواضيع
      58
      شكر / اعجاب مشاركة

      رد: a function mneu_option() ..... مسألة في C++

      ماهي شروط اللعب توابع بنى أم صفوف
      العملي دون النظري عمل أعمى والنظري دون العملي عمل ليس له فائدة

    3. #3
      التسجيل
      16-02-2007
      المشاركات
      298
      المواضيع
      58
      شكر / اعجاب مشاركة

      رد: a function mneu_option() ..... مسألة في C++

      هذا هو الحل بدون توابع التعامل مع المحارف يرجى الاطلاع لمن يهمه الأمر
      كود PHP:
      #include<iostream.h>
      #include<math.h>
      #include<stdlib.h>
      void Display(void);
      void Choise (char);
      void Prime(int int) ;
      double PI ( double );
      void rev_order(int) ;
      void main()
      {
       
      char c;
       while(
      1)
       {
        
      Display();
        
      cin >> ;
        
      Choise(c) ;
       }
       return ;
      }

      void Display(void)
      {
       
      cout << "Welcome This is the program menu Please Print the number your choice"<< endl
         
      << "1. Numeric calculation " << endl 
         
      << "     a. Prime numbers " << endl
         
      << "     b. Pi approxmiation " << endl 
         
      << "     c. Reverse order " << endl
         
      << endl
         
      << "2. Text Analysis " << endl
         
      << "3. Searching a text " << endl
         
      << "4. Exit " << endl ;
      }
      void Choise(char c)
      {
       switch( 
      )
       {
       case 
      'a':
        {
         
      int a ;
         
      cout << " Enter two numbers a , b " << endl ;
         
      cin >> >> ;
            
      Prime(b) ;
        }
        break ;
       case 
      'b':
        {
         
      double n ;
         
      cout << "Please enter a number " << endl ;
         
      cin >> ;
         
      cout << PI(n) << " is approximtly to " << << endl ;
        }
        break ;
       case 
      'c':
        {
         
      int k ;
         
      cout << "Enter anumber " << endl ;
         
      cin >> ;
         
      rev_order(k);
        }
        break ;
       
       case 
      '4' :
        exit(
      1);
       
       default:
        
      cout << " You choise is not correct " << endl;
       }
      }
      void Prime(int a int b)
      {
       
      bool D ;
       for(
      int i <= i++)
       {
        
      true ;
        for(
      int j <= i/j++)
        {
         if(
      i%== 0)
         {
          
      false ;
          break ;
         }
        }
        if(
      D)
         
      cout << << "   " ;
       }
      }
       
      double PI(double n)
      {
       return 
      floor(n) ;
      }
      void rev_order(int k)
      {
       
      cout << " The Reverse of " << << " is " ;
       
      int rk ;
       while(
      k/10 != 0)
       {
        
      rk *= 10 ;
        
      rk += k%10 ;
        
      k/10 ;
       }
       
      cout << rk*10 << endl ;

      العملي دون النظري عمل أعمى والنظري دون العملي عمل ليس له فائدة

    4. #4
      التسجيل
      04-11-2007
      المشاركات
      26
      المواضيع
      1
      شكر / اعجاب مشاركة

      رد: a function mneu_option() ..... مسألة في C++

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

      سوري ما فهمت عليك

      بس شوووف الطريقة تكون باستخدام الفانكشن والطريقة تكون مثل هذا المثال البسيط


      كود PHP:
      [left][left]//This porgram reads a value n, call a function fact to compute n!, [/left]
      [left]//and another function to find the value of e approximated to n terms[/left]
      [left] [/left]
      [
      left]#include <iostream>[/left]
      [left]#include <cmath>[/left]
      [left]using namespace std;[/left]
      [
      left] [/left]
      [
      left]int fact(int x);[/left]
      [
      left] [/left]
      [
      left]double E(int y);[/left]
      [
      left] [/left]
      [
      left]int main()[/left]
      [
      left]{[/left]
      [
      left]   int n;[/left]
      [
      left]   double e;[/left]
      [
      left] [/left]
      [
      left]   cout <<"please Enter the value of n : ";[/left]
      [
      left]   cin >>n;[/left]
      [
      left]   cout << "\nThe Factorial of n (n!) = " << fact(n) <<endl<< endl;[/left]
      [
      left]   E(n);[/left]
      [
      left]   cout<< "E approximated to "<< <<" terms is " << << endl<< endl;[/left]
      [
      left]  [/left]
      [
      left]   return 0;[/left]
      [
      left]}[/left]
      [
      left] [/left]
      [
      left]/*----------------------------------------------------------------*/[/left]
      [
      left] [/left]
      [
      left]int fact(int k){[/left]
      [
      left]    int fac=1;[/left]
      [
      left]    for(int i=1;i<=k;i++)[/left]
      [
      left]               fac *=i;[/left]
      [
      left]    return fac;[/left]
      [
      left]}[/left]
      [
      left] [/left]
      [
      left]/*------------------------------------------------------------------*/[/left]
      [
      left] [/left]
      [
      left]double E(int n){[/left]
      [
      left]   double e=1;[/left]
      [
      left]    for (int i=1;i<=n;i++) [/left]
      [
      left]                +=1.0/fact(i);[/left]
      [
      left]    return e;[/left]
      [
      left]}[/left]
      [
      left] [/left]
      [
      left]/*-------------------------------------------------------------------*/[/left]
      [
      left] [/left]
      [
      left] [/left][/left

    5. #5
      التسجيل
      04-11-2007
      المشاركات
      26
      المواضيع
      1
      شكر / اعجاب مشاركة

      رد: a function mneu_option() ..... مسألة في C++

      اقتباس المشاركة الأصلية كتبت بواسطة أميرة الوفاء مشاهدة المشاركة
      مشكور على الحل بس ما هي الطريقة المطلوبة..

      سوري ما فهمت عليك

      بس شوووف الطريقة تكون باستخدام الفانكشن والطريقة تكون مثل هذا المثال البسيط


      كود PHP:
      [left][left]//This porgram reads a value n, call a function fact to compute n!, [/left]
      [left]//and another function to find the value of e approximated to n terms[/left]
      [left] [/left]
      [
      left]#include <iostream>[/left]
      [left]#include <cmath>[/left]
      [left]using namespace std;[/left]
      [
      left] [/left]
      [
      left]int fact(int x);[/left]
      [
      left] [/left]
      [
      left]double E(int y);[/left]
      [
      left] [/left]
      [
      left]int main()[/left]
      [
      left]{[/left]
      [
      left]   int n;[/left]
      [
      left]   double e;[/left]
      [
      left] [/left]
      [
      left]   cout <<"please Enter the value of n : ";[/left]
      [
      left]   cin >>n;[/left]
      [
      left]   cout << "\nThe Factorial of n (n!) = " << fact(n) <<endl<< endl;[/left]
      [
      left]   E(n);[/left]
      [
      left]   cout<< "E approximated to "<< <<" terms is " << << endl<< endl;[/left]
      [
      left]  [/left]
      [
      left]   return 0;[/left]
      [
      left]}[/left]
      [
      left] [/left]
      [
      left]/*----------------------------------------------------------------*/[/left]
      [
      left] [/left]
      [
      left]int fact(int k){[/left]
      [
      left]    int fac=1;[/left]
      [
      left]    for(int i=1;i<=k;i++)[/left]
      [
      left]               fac *=i;[/left]
      [
      left]    return fac;[/left]
      [
      left]}[/left]
      [
      left] [/left]
      [
      left]/*------------------------------------------------------------------*/[/left]
      [
      left] [/left]
      [
      left]double E(int n){[/left]
      [
      left]   double e=1;[/left]
      [
      left]    for (int i=1;i<=n;i++) [/left]
      [
      left]                +=1.0/fact(i);[/left]
      [
      left]    return e;[/left]
      [
      left]}[/left]
      [
      left] [/left]
      [
      left]/*-------------------------------------------------------------------*/[/left]
      [
      left] [/left]
      [
      left] [/left][/left
      سوري ما عرف كيف طلع ذا اللفت.. بدون لفت

      المهم مثل هذا المثال

    6. #6
      التسجيل
      04-11-2007
      المشاركات
      26
      المواضيع
      1
      شكر / اعجاب مشاركة

      رد: a function mneu_option() ..... مسألة في C++

      للرفع


      نو ون وانت تو سولف ات

      اتز انترستينج



    ضوابط المشاركة

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