#include <iostream>
using namespace std;
int main()
{
int a, sumPositive, sumNegative;
string promptContinue = "\n To continue enter 'y or Y', and to discontinue and get calculation result enter 'n or N' \n";
string promptNum = "\nEnter a number : ";
char response;
cout << promptContinue;
cin >> response;
while (response = 'y'|'Y')
{
cout << promptNum;
cin >> a;
if(a >= 0 ){
sumPositive += a;
}
else
sumNegative += a;
cout << promptContinue;
}
cout << "Sum of all the positive numbers is : " << sumPositive <<endl;
cout << "Sum of all the positive numbers is : " << sumNegative <<endl;
return 0 ;
}
Итак, что программа должна: - получать пользовательский ввод до тех пор, пока пользователь не наберет 'n или N', чтобы показать знак остановки; - когда пользователь введет 'n или N', тогда программная сумма положительного числа кака также сумма отрицательных чисел.
И что я получаю
Permission denied
collect2.exe: error: ld returned 1 exit status
[Finished in 0.5s with exit code 1]
это сообщение об ошибке, и я не уверен, в чем проблема. Заранее спасибо!