السلام عليكم ورحمة الله وبركاته
هذا الكود المطلوب
- Write C++ program that reads a series of values from the user (read
until the user entered 0) then find the sum of these numbers
وهذه محاولتي
#include<iostream.h>
#include<conio.h>
void main()
{
int x ;
int sum=0;
cout<< "enter a number (0 to end)";
cin>>x;
while(x!=0)
{
cout<<"enter a number (0 to end)";
cin>>x;
sum +=x;
}
if(x=0)
cout<<sum;
getch();
}مشكلتي في الجزء الثاني من السؤال وهو المجموع
كيف اعرّف sum لاعداد مدخله غير محدوده؟
اتمنى تساعدوني
وشكرا مقدما :happy:

