السلام عليكم ورحمة الله
أنا مبتدئ في لغة C++ وأستخدم برنامج VC6.0
وقد كتبت هذا الكود في البرنامج وظهر أن فيه أخطاء ولا أعرف كيف أصححه فأرجو مساعدتي
وهذا الكود:
# include <iostream.h>
main()
{
int n1,n2
char h1;
cout<<"Enter Frist Number:\n";
cin>>n1;
cout<<"Enter Second Number:\n";
cin>>n2
cout<<"do you want Sum the Numbers?:\n"
cin>>h1;
if (h1= sum) cout<<"the Value:\n" << n1+n2;
else cout<<"ERROR\n";
}
وفكرة الكود أن المستخدم يدخل رقمين ثم أسأله أذا كان يريد جمعهما فإذا كتب Sum يتم جمعهما وإذا لم يكتب تظهر كلمة ERROR
ولكن ظهرت أخطاء وهاهي الأخطاء
--------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
I:\C++\E?C?? E?UE C++\New Folder\Cpp1.cpp(5) : error C2144: syntax error : missing ';' before type 'char'
I:\C++\E?C?? E?UE C++\New Folder\Cpp1.cpp(6) : error C2146: syntax error : missing ';' before identifier 'cout'
I:\C++\E?C?? E?UE C++\New Folder\Cpp1.cpp(10) : error C2146: syntax error : missing ';' before identifier 'cout'
I:\C++\E?C?? E?UE C++\New Folder\Cpp1.cpp(11) : error C2146: syntax error : missing ';' before identifier 'cin'
I:\C++\E?C?? E?UE C++\New Folder\Cpp1.cpp(12) : error C2065: 'sum' : undeclared identifier
I:\C++\E?C?? E?UE C++\New Folder\Cpp1.cpp(14) : warning C4508: 'main' : function should return a value; 'void' return type assumed
Error executing cl.exe.
Cpp1.exe - 5 error(s), 1 warning(s)
وجزاكم الله خيراً


