مشاهدة النسخة كاملة : مساعدة في السي++
abddarw
17-10-2005, 10:12 PM
السلام عليكم
كيف استطيع ان اجري اختبارا في السي ++ لعدد صحيح مؤلف من خمس خانات اذا كا ن palindromes ام لا
ال palindromes يعني عدد يقرا من اليمين كما يقرا من اليسار
مثل
12321
44444
54445
22922
علما اني لا اريد ادخاله في مصفوفة
مشكورين سلفا
The Coder
18-10-2005, 03:55 AM
السلام عليكم ..
خليني اخش في الموضوع على طول
البرنامج هو ذا .. يمكن فيه شوية اخطاء ... ماعندي سي++ ولكن ... اذا اي سوال اسال ...
include <iostream.h>
void main ()
{
cout << " enter x : ";
int x ;
cin >> x ;
if (x>9999 && x <100000)// if x is 5- digit number
{
int a1 = x%10000 ;
x/=10;
int a2 =x%1000 ;
x/=10;
int a3 = x% 100 ;
x/=10;
int a4 = x% 10 ;
x/= 10 ;
int a5 = x ;
// now if the first = the last >> and the second = the fourth ..that mean palindromes number
if (a1==a5 && a2==a4)
cout << "this is the palindromes number";
else
cout<< "this is not the palindromes number ";
}
else
cout <<"must 5 digit number ";
}
abddarw
18-10-2005, 11:15 PM
السلام عليكم ..
خليني اخش في الموضوع على طول
البرنامج هو ذا .. يمكن فيه شوية اخطاء ... ماعندي سي++ ولكن ... اذا اي سوال اسال ...
include <iostream.h>
void main ()
{
cout << " enter x : ";
int x ;
cin >> x ;
if (x>9999 && x <100000)// if x is 5- digit number
{
int a1 = x%10000 ;
x/=10;
int a2 =x%1000 ;
x/=10;
int a3 = x% 100 ;
x/=10;
int a4 = x% 10 ;
x/= 10 ;
int a5 = x ;
// now if the first = the last >> and the second = the fourth ..that mean palindromes number
if (a1==a5 && a2==a4)
cout << "this is the palindromes number";
else
cout<< "this is not the palindromes number ";
}
else
cout <<"must 5 digit number ";
}
شكرا الك اخوي :ciao:
بس في خطا لان عند التنفيذ دائما (this is not the palindromes number )
وحتى جربت امرر عدد يدويا ماركز
بحب كرر شكري لك:D
abddarw
18-10-2005, 11:34 PM
اخوي شكرا الك قدرت زبطوا كان في خطأ بالقسمة وبضن انو هيك صار صح
#include <iostream.h>
void main ()
{
cout << " enter x : ";
int x ;
cin >> x ;
if (x>9999 && x <100000)// if x is 5- digit number
{
int a1 = x/10000 ;
x=x%10000;
int a2 =x/1000 ;
x=x%1000;
int a3 = x/ 100 ;
x=x%100;
int a4 = x/ 10 ;
x=x% 10 ;
int a5 = x ;
// now if the first = the last >> and the second = the fourth ..that mean palindromes number
if (a1==a5 && a2==a4)
cout << "this is the palindromes number";
else
cout<< "this is not the palindromes number ";
}
else
cout <<"must 5 digit number ";
}
:ciao: مشكور لمساعدتك
The Coder
19-10-2005, 01:17 AM
اخوي شكرا الك قدرت زبطوا كان في خطأ بالقسمة وبضن انو هيك صار صح
#include <iostream.h>
void main ()
{
cout << " enter x : ";
int x ;
cin >> x ;
if (x>9999 && x <100000)// if x is 5- digit number
{
int a1 = x/10000 ;
x=x%10000;
int a2 =x/1000 ;
x=x%1000;
int a3 = x/ 100 ;
x=x%100;
int a4 = x/ 10 ;
x=x% 10 ;
int a5 = x ;
// now if the first = the last >> and the second = the fourth ..that mean palindromes number
if (a1==a5 && a2==a4)
cout << "this is the palindromes number";
else
cout<< "this is not the palindromes number ";
}
else
cout <<"must 5 digit number ";
}
:ciao: مشكور لمساعدتك
لا شكر على واجب .. يافتى
واي شي تبيه .. حياك الله في اي وقت ...
يالله شد حيلك .... وتشطر ... عشان تصير محترف .. ونشوفك هنا تسوي برامج .. وتخدم البشرية ^_^
الله وياك ^_^
abddarw
20-10-2005, 12:40 AM
لا شكر على واجب .. يافتى
واي شي تبيه .. حياك الله في اي وقت ...
يالله شد حيلك .... وتشطر ... عشان تصير محترف .. ونشوفك هنا تسوي برامج .. وتخدم البشرية ^_^
الله وياك ^_^
انشاء الله اكون عند حسن ظنك:D
جميع حقوق برمجة vBulletin محفوظة ©2025 ,لدى مؤسسة Jelsoft المحدودة.
جميع المواضيع و المشاركات المطروحة من الاعضاء لا تعبر بالضرورة عن رأي أصحاب شبكة المنتدى .