السلام عليكم
يا اخوان
لو سمحتم سويت هالكود مشان احسب ال mid_sqaure method
لكن وصلت الى مرحلة..
وكان فيه خطأ في حساب ال عدد خانات الرقم x وهو انو لا يحسب الا لحد 5 خانات فقط
و ال void showx لا تعمل
يجب ان انهي الكود قبل الغد ممكن حد يساعدني ..؟
كود:#include<iostream.h> #include<conio.h> class mid_sqaure { private: public: int x;//x is seed number. int count; //number of digi. void getx(); int get_digi(); void showx(); }; void mid_sqaure::getx() { cout<<"Enter x\n"; cin>>x; } ////////////////////////////////// int mid_sqaure::get_digi() { //int count=0; count=0; while(x!=0) { count++; x/=10; } return count; } ////////////////////////////// /*void mid_sqaure::showx() { if(count%2=0) cout<<" even"; else cout<<"odd"; } */ ////////////////////////////// void main() { clrscr(); mid_sqaure MS; MS.getx(); cout<<"the number of digi is :"<<MS.get_digi(); //MS.showx(); getch(); }





























