Cześć, czy jest ktoś wstanie poprawić kod lub pomóc mi w zmianie koloru tekstu BZZ something..... itd. i zabezpieczyć się przed podaniem złych danych wykrzykników, liter, i innych znaków oprócz kropki która będzie wykorzystywana do ułamków dziesiętnych.
#include <iostream>
using namespace std;
float longer,shorter,score;
int main()
{
cout<<"Hi, this is program to calculate a deltoid field. If you want to enter a decimal fraction, use a dot"<< endl;
cout<<"Give the length of the longer height:"<< endl;
cin>>longer;
cout<<"Give the length of the short height:"<<endl;
cin>>shorter;
if(longer==0 ||shorter==0)
{
cout<<"Bzzz something is wrong"<<endl;
cout<<"Give again the length of the longer height:"<< endl;
cin>>longer;
cout<<"Give again the length of the short height:"<<endl;
cin>>shorter;
score = (longer*shorter)/2;
cout<<"This is your score:"<<score<<endl;
return 0;
}
score = (longer*shorter)/2;
cout<<"This is your score:"<<score<<endl;
return 0;
}