#include <iostream>
usingnamespace std;
int main()
{
double m, n, p, q, r, s, t;
double f = m + n / (p + q / (r + s / t));
cout << "Please enter value for M: ";
cin >> m;
cout << "\nPlease enter value for N: ";
cin >> n;
cout << "\nPlease enter value for P: ";
cin >> p;
cout << "\nPlease enter value for Q: ";
cin >> q;
cout << "\nPlease enter value for R: ";
cin >> r;
cout << "\nPlease enter value for S: ";
cin >> s;
cout << "\nPlease enter value for T: ";
cin >> t;
cout << endl;
(t==0, (r + s / t)==0, (p + q / (r + s / t))==0)? cout << "There was a division by 0. Please put different values.":
cout << f << endl;
return 0;
}
double m, n, p, q, r, s, t; Value of all those nimbers is undefined double f = m + n / (p + q / (r + s / t)); Value of result is undefined because all operands are undefined.
Eh, I guess not lol, and how do I fix line 25? It really doesn't work,
Correct me if I'm wrong ( and I probably am ) but would it be better to replace all ==0 to !=0 and switch the places of the true/false cout-s ?