Im trying to build a program that takes input from the user adds it the list and sums it but when i add some letters or a number like this 2,2 instead of 2.2 the program stops, how can i make it so the program tells the user that is not valid and lets him type again?
Thanks
int main()
{
float transaction = 0 ;
float sum = 0;
list <float> account;
do{
cout << "Insert a transaction or press 0 to end: " << endl;
cin >> transaction;
sua += transaction;
account.push_back(transaction);
}
while (transaction != 0);