This is my error report, which I do not understand at all.
1>------ Build started: Project: Lab 7test, Configuration: Debug Win32 ------
1> timetest1.cpp
1>timetest1.cpp(29): error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion)
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\exception(470): could be 'bool std::operator ==(const std::_Exception_ptr &,const std::_Exception_ptr &)'
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\exception(475): or 'bool std::operator ==(std::_Null_type,const std::_Exception_ptr &)'
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\exception(481): or 'bool std::operator ==(const std::_Exception_ptr &,std::_Null_type)'
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\system_error(408): or 'bool std::operator ==(const std::error_code &,const std::error_condition &)'
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\system_error(416): or 'bool std::operator ==(const std::error_condition &,const std::error_code &)'
1> while trying to match the argument list '(std::string, int)'
1>timetest1.cpp(29): error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion)
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\exception(470): could be 'bool std::operator ==(const std::_Exception_ptr &,const std::_Exception_ptr &)'
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\exception(475): or 'bool std::operator ==(std::_Null_type,const std::_Exception_ptr &)'
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\exception(481): or 'bool std::operator ==(const std::_Exception_ptr &,std::_Null_type)'
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\system_error(408): or 'bool std::operator ==(const std::error_code &,const std::error_condition &)'
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\system_error(416): or 'bool std::operator ==(const std::error_condition &,const std::error_code &)'
1> while trying to match the argument list '(std::string, int)'
1>timetest1.cpp(35): error C2450: switch expression of type 'std::string' is illegal
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>timetest1.cpp(113): error C2450: switch expression of type 'std::string' is illegal
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Here are some changes that I have done so far but still get the same error messages stated above......
// This program will let the user input the time and minutes in 24 hour format
// and printout on the screen the English time format. The program will continue
// until the user inputs -9 or -59.
Line 5: Get rid of stdafx.h if you're building a console application.
Line 26, 32: You need to use double quotes when comparing with a std::string.
Line 38,116: You can't use a string in a switch statement.
Lines 40-112, 118-295: Your case values are character literals, not numeric values.
Line 300,306: You can't compare a string to an int.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
When you are comparing your strings hourstr and minutestr to check for noon and midnight you used == to compare to a char. This could be causing some of the errors. The other thing is you are using relational operators at the end of your program between strings and integers which definitely is causing an error. If you could post the line numbers I might be able to help you more but see if fixing the == between string and char helps and change the >= and != at the end of the program too.
1> testingtime.cpp
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(29): error C2446: '==' : no conversion from 'const char *' to 'int'
1> There is no context in which this conversion is possible
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(29): error C2040: '==' : 'int' differs in levels of indirection from 'const char [3]'
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(29): error C2446: '==' : no conversion from 'const char *' to 'int'
1> There is no context in which this conversion is possible
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(29): error C2040: '==' : 'int' differs in levels of indirection from 'const char [3]'
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(34): error C2446: '==' : no conversion from 'const char *' to 'int'
1> There is no context in which this conversion is possible
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(34): error C2040: '==' : 'int' differs in levels of indirection from 'const char [3]'
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(34): error C2446: '==' : no conversion from 'const char *' to 'int'
1> There is no context in which this conversion is possible
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(34): error C2040: '==' : 'int' differs in levels of indirection from 'const char [3]'
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(42): error C2051: case expression not constant
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(111): error C2065: 'z' : undeclared identifier
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(111): error C2143: syntax error : missing ':' before 'constant'
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(111): error C2051: case expression not constant
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(112): error C2146: syntax error : missing ';' before identifier 'resulthours'
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(114): error C2051: case expression not constant
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(117): warning C4060: switch statement contains no 'case' or 'default' labels
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(121): error C2051: case expression not constant
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(301): warning C4060: switch statement contains no 'case' or 'default' labels
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(303): error C2446: '>=' : no conversion from 'const char *' to 'int'
1> There is no context in which this conversion is possible
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(303): error C2040: '>=' : 'int' differs in levels of indirection from 'const char [3]'
1>c:\users\david\documents\visual studio 2010\projects\lab 7.5\lab 7.5\testingtime.cpp(309): error C2106: '=' : left operand must be l-value
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========