روح طفله
Active Member
- تاريخ التسجيل
- 27 أكتوبر 2009
- المشاركات
- 32
- المجموعة
- أنثى
- الدفعة الدراسية
- 2009
- الكلية
- كلية تقنية المعلومات
Question 3 (15 points) Write a function trapezoid(int start, int end) that generates a trapezoid of numbers as shown below . start and end are integers from 0 to 9 inclusive and assume that the value of start is ≤ the value of end.
For example, if the value of start is 4 and end is 7, the trapezoid should be:
4444
55555
666666
7777777
PHP:
include <iostream> #
using namespace std;
void trapezoid (int start, int end);
int main ()
{
trapezoid (4,7);
return 0;
}
void trapezoid (int start, int end)
{
int i, e;
i=start;
e=end;
while (i>=0 && e<=9)
{
for( i; i<=end; i++)
{
for (int j=1; j<=i; j++)
{
cout<<i;
}
cout<<endl;
}
}
الحل خطأ

لأن في السؤال مكتوب فور اكزامبل مو شرط يكون الستارت 4 والاند 7 !!
فشلون يصير الحل الصح؟


