Hello stonedviper,
I will get this this out of the way first. Change your "float"s to "doubles"s. "doubles"s are the preferred type these days. Also have a look at this, lines 3 and 4,:
http://www.cplusplus.com/forum/beginner/221554/#msg1017350
I see you added a function. At first look I do not see anything wrong with the function. Although you could just as easily say:
return sleepprice*staytime;
Lines 60 - 63 always initialize your variables. Some you have and some you have not.
Line 64 was fine with your original code you just needed a different variable set to a number greater than zero. This works though.
line 74 I would follow with
operation=tolower(operation);
, so the switch has the proper case for the letters.
Line 66 is an endless loop with no way out. Your original code here is better,
Lines 79 and I think line 153, hard to tell the way the code is indented, do not have to be there, but it is OK if they are.
Line 80 should not be needed or be there, but it does work with line 82 now.
Line 82 along with line 80 I believe this while loop will execute only once. So, that makes the while loop mostly unnecessary.
Lines 84 to 95 re OK, but you might want to consider this:
1 2 3 4 5 6 7 8 9 10 11 12
|
std::cout << "Enter the name of the guest: ";
std::cin >> imenagost;
std::cout << "Enter ID number: ";
std::cin >> egnnagost;
std::cout << "Enter where does the guest reside: ";
std::cin >> naselenomqsto;
std::cout << "Enter how long will the guest stay: ";
std::cin >> dalgotraene;
std::cout << "Enter how much does it cost stay per night: ";
std::cin >> noshtuvka;
std::cout << "Enter martial status: ";
std::cin >> martial;
|
This just makes the output and input look better.
Line 96 is a good addition, but the while loop is not really needed. The point is to store the information in one array or the other. You just need to keep track of the value of the variable used in the subscript for "vaas" and "vaas2", "i" and "k" respectfully, since they are likely to be of different values.
Lines 11 on the additional case statements. They look OK for now I will have to test them out and see what happens.
Line 147 Not the way I would have done it, but the return will either exit the while loop or the program, not sure which yet.
My last note for now is to watch your indenting. Proper indenting makes the code easier to read. As n example lines 153 and 154 it is hard to tell which } lines up with the opening {. And the case statements would look better indented from the switch {}s.
Hope that helps,
Andy