Kod: Zaznacz cały
#include <iostream>
#include <conio.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
float suma=0;
float iloczyn=1;
int licznik=0;
bool podana=true;
while (podana==true)
{
licznik=licznik+1;
int a[licznik];
cout << "Podawaj liczby do momentu wpisania zera"<< endl;
cin >> a[licznik];
if (a[licznik]==0)
{
podana=false;
cout << "podales zero koncze wczytywanie liczb" << endl;
}
for (int i=0; i<licznik; i++)
{
suma=suma+a[i];
iloczyn=iloczyn*a[i];
}
}
cout << suma;
cout << iloczyn;
getch();
return 0;
}