ملتقى البرمجة
اهلا بك زائرنا الكريم ..
اذا كانت هذه هيالزيارة الاولى لك فاننا ندعوك الى التسجيل بالمنتدى او التعريف بنفسك
مع العلم ان الزوار لا يستطيعون مشاهدة كل المواضيع المطروحة بالمنتدى


انضم إلى المنتدى ، فالأمر سريع وسهل

ملتقى البرمجة
اهلا بك زائرنا الكريم ..
اذا كانت هذه هيالزيارة الاولى لك فاننا ندعوك الى التسجيل بالمنتدى او التعريف بنفسك
مع العلم ان الزوار لا يستطيعون مشاهدة كل المواضيع المطروحة بالمنتدى
ملتقى البرمجة
هل تريد التفاعل مع هذه المساهمة؟ كل ما عليك هو إنشاء حساب جديد ببضع خطوات أو تسجيل الدخول للمتابعة.

enter 3 char. and the program should rearrange them and print the result in main function

3 مشترك

اذهب الى الأسفل

enter 3 char. and the program should rearrange them and print the result in main function Empty enter 3 char. and the program should rearrange them and print the result in main function

مُساهمة من طرف aya 22/4/2011, 8:07 pm



enter 3 char. and the program should rearrange them and print the result in main function

الكود:

#include <iostream>
void order(char &x,char &y,char &z);
using namespace std;
void main(){
char x,y,z;
   cout<<"enter 3 characters: ";
   cin>>x>>y>>z;

order(x,y,z);
   
cout<<"the order is "<<x<<" "<<y<<" "<<z;
cout<<endl;
system ("pause");
}

void order(char &x,char &y,char &z){
   char max,min,middle;

   //for comparing
   if(x>y){
max=x;
min=y;
if(z>x){
max=z;
middle=x;}
else if (z<y)
{min=z;
middle=y;}
else middle=z;
   }
   else if (x<y){
max=y;
min=x;
if(z>y){
max=z;
middle=y;}
else if (z<x)
{min=z;
middle=x;}
else middle=z;}

x=min;
y=middle;
z=max;

}

Neutral
aya
aya

عدد المساهمات : 4
تاريخ التسجيل : 18/04/2011

الرجوع الى أعلى الصفحة اذهب الى الأسفل

enter 3 char. and the program should rearrange them and print the result in main function Empty رد: enter 3 char. and the program should rearrange them and print the result in main function

مُساهمة من طرف Basel Tamimi 23/4/2011, 6:18 am

thanxxxx aya ^__^
Basel Tamimi
Basel Tamimi

عدد المساهمات : 44
تاريخ التسجيل : 09/03/2011
العمر : 32
الموقع : الخليل

https://is-it1.alafdal.net/

الرجوع الى أعلى الصفحة اذهب الى الأسفل

enter 3 char. and the program should rearrange them and print the result in main function Empty رد: enter 3 char. and the program should rearrange them and print the result in main function

مُساهمة من طرف anas mohtaseb 24/4/2011, 11:46 am

enter 3 char. and the program should rearrange them and print the result in main function Z5745462
anas mohtaseb
anas mohtaseb

عدد المساهمات : 29
تاريخ التسجيل : 08/03/2011
الموقع : https://www.facebook.com/anasmohtaseb

https://www.facebook.com/anasmohtaseb

الرجوع الى أعلى الصفحة اذهب الى الأسفل

الرجوع الى أعلى الصفحة

- مواضيع مماثلة

 
صلاحيات هذا المنتدى:
لاتستطيع الرد على المواضيع في هذا المنتدى