At this stage I will obtain Dimensions A, B & C. But after this before I do the pythagoras equation using the data I want it checked over. I think I've done this here but I'm not sure. I want it to report the message "Invalid Data" if Dimension A is not the longest.
You will need to change your if statement in order for this to work out. In your code, the comma plus DimC has no effect. Your code does not match your described goal, either.
So basically I want to enter three Dimensions (A, B & C). And if A is not the longest (biggest number) then a message will appear telling the user that it is Invalid Data and should reenter different data for Dimension A.
#include <iostream>
usingnamespace std;
// You're not allowed to have a "float" for the return value of the main function. It must be "int."
// Main should also be lowercase.
float Main()
( // should be {
double DimA; double DimB; double DimC;
cout << "Enter Dimension A:-"; / // Stray forward slash!
cin >> DimA;
cout << "Enter Dimension B:-";
cin >> DimB;
cout << "Enter Dimension C:-";
cin >> DimC;
if (dimA <= dimB || dimA <= dimC)
cout << "Invalid Data";
) // should be }
Try using loops or gotos to request for input again.
Oversight on my part there :) It now works, well kind of. So I can input the Dimensions but once I've entered the last Dimension (C) it nows closes the program. It doesn't show the "Invalid Data" message as it should.