السلام عليكم ورحمة الله
عندي مشروع في ماده البرمجه
ومطلوب مني برنامج c++
تونا مبتدئين اول ترم الحين
فكرت ببرنامج حساب العمر
اقتباس
int dn , mn , yn , dl , ml , yl ;
int ad , am , ay ;
char ch ;
do
{
cout << " Enter now day , now month and now year : " << endl ;
cin >> dn >> mn >> yn ;
cout << " Enter last day , last month and now year : " << endl ;
cin >> dl >> ml >> yl
كذا البدايه تمام
دورت بالنت طلع لي كود بس ما فهمته .. الاستاذه تقول اذا بتجيبي لي من النت لازم يكون بفهم
ابي احد يشرح لي هالخطوات اللي داخل if
اقتباس
if (dn < dl)
{
dn = dn + 30 ;
mn = mn - 1 ;
}
if (mn < ml)
{
mn = mn + 12 ;
yn = yn - 1 ;
}
ad = dn - dl ;
am = mn - ml ;
ay = yn - yl ;
cout << "The age is " << ay <<" year and "
<< am <<" month and "
<< ad <<" day" << endl ;
cout << " Do Again : (y/n) ? " ;
cin >> ch ;
}
while (ch != 'n' ) ;
}
:(