Hello, Help Me Please With algorithm. I have a really hard task with C++.
Here's my txt files
Classes first number class second day third lesson number and last one lesson name
2a monday 1 history 2 math 3 biology 4 x
2a tuesday 1 math 2 history 3 art 4 music
2a wednesday 1 biology 2 history
2a thursday 1 math 2 programming 3 art
2a friday 1 math 2 x
2b monday 1 math 2 biology 3 art 4 x
2b tuesday 1 art 2 math 3 biology 4 x
2b wednesday 1 biology 2 geography 3 music
2b thursday 1 histrory 2 math 3 art
2b friday 1 music 2 technology 3 art
Teachers (sport) first number day second which lesson are the sport and last one if the have that lesson 1-yes 0-no.
And I need to chech them.
For example if in Classes txt file on Monday are x and in Teachers on monday is 4(lesson) and 0(teacher dont hav a lesson) and in BestTime on monday is 4 then program should writte Sport instead of x in a timetable.
So, it is possible to get help? :/ I have written this program, but it has a lot of errors... Here's my code http://pastebin.com/2cWAr2eA (ERROR start at 152 line :(
Stringing the operator== 's together is not doing what you expect because operator== returns a bool.
Simple example:
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
int main(){
int x(42);
int y(42);
int z(42);
if(x == y == z)
std::cout << "All are equal" << std::endl;
else
std::cout << "Not equal" << std::endl;
}
Output:
Not equal
x == y evaluates to true(1) which is not equal to 42.
The reason you get an error is the compiler cannot evaluate bool == std::string.