الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مساعدة في كود لجدول الضرب ++C

مغلقمُجاب
بدأه شداد في 19 يونيو 2014 · 5 رد · 1,403 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

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

 

لقد قمت بكتابة كود لطباعة جدول الضرب من العدد 1- 10 ولكن تواجهني مشكلة بان الجداول تكون فوق بعضها البعض فكيف اجعل جدول كل رقم بجانب الأخر وهذا هو الكود 

#include <iostream>

using namespace std;

int main()
{
  for (int b = 1; b <= 10; b=b+1)
  for (int c = 1; c <= 10; c=c+1) 

  cout << b << "x" << c << "=" << b*c <<  endl;
  
   return 0;
}

وهذه صورة توضيحية 

 

 

10483164_573976572718927_326762873493883

#2

فكر , انها مسألة تفكير وحسب

ربما يفيدك هذا

#include <iostream>

using namespace std;

int main()
{
for (int b = 1; b <= 10; b=b+1)
{
for (int c = 1; c <= 10; c=c+1)

cout << b << "x" << c << "=" << b*c ;
 
cout<<endl;
}
return 0;
}
#3 أفضل إجابة

#include <cstdlib>

#include <iostream>

using namespace std;

/* Prototype : */

void ligne_horizontale ();

void calculer_test (int , int);

void laisser_un_vide (int , int);

/* ............................... */

int main()

{

int x(3),y(2);

ligne_horizontale();

for (int b(1) ; b <= 10 ; b += 3 )

{

for (int c(1); c <= 10; c++)

{

cout <<" - "<< b << " x " << c ;

calculer_test(c , b);

laisser_un_vide(c , b);

if( y > 10)

{

cout<< endl;

continue;

}

cout<< y << " x " << c ;

calculer_test(c , y);

laisser_un_vide(c , y);

cout<< x << " x " << c ;

calculer_test( c , x);

cout<< endl;

}

x += 3;

y += 3;

ligne_horizontale();

}

system("pause");

return 0;

}

/* .......................... F o n c t i o n ............................ */

void ligne_horizontale()

{

cout<<"\n...............................................................\n\n";

}

/* .................................................... */

void calculer_test( int a , int b)

{

if( a == 10 )

cout<<" = " << a*b ;

else

cout<<" = " << a*b ;

}

/* .................................................... */

void laisser_un_vide( int a , int b )

{

if( a*b >= 10 )

cout<<" | ";

else

cout<<" | ";

}

/* .................................................... */

تم تعديل هذه المشاركة بواسطة yacinebrca في 20 يونيو 2014 في 14:27

1

elearning_image.jpg

#4

 واليك هذا الحل ايضا ... نفسه لكن بدون كتابة دوااال...

#include <iostream>
 
using namespace std;
 
int main()
{

  cout<<"\n\n";

for (int b = 1,y=2,x=3; b <= 10; b=b+3,x=x+3,y=y+3)
  {
                  for (int c = 1; c <= 10; c=c+1)
               {
               cout << b << " x " << c ;if(c==10) cout<<" = " << b*c ;else cout<<"  = " << b*c ;
               if( b*c >= 10 )
                       cout<<"        |  ";
               else
                       cout<<"         |  ";
               if( y>10) {cout<< endl;continue;}
                cout<< y << " x " << c  ;if(c==10) cout<<" = " << y*c ;else cout<<"  = " << y*c ;
                 if( y*c >= 10 )
                       cout<<"        |  ";
               else
                       cout<<"         |  ";
                
                
              cout<< x << " x " << c ;if(c==10) cout<<" = " << x*c ;else cout<<"  = " << x*c ;
             
                 cout<< endl;
                      }
                      
              cout<<"\n........................................................................\n\n";
}        
system("pause");
return 0;
}

elearning_image.jpg

#5

العفو الاخ مصطفى  .... :blush:

elearning_image.jpg

#6

يعطيكم العافية شباب 

هذا الموضوع مغلق.

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…