Help Me Please With algorithm. C++

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.

monday 5 1
tuesday 3 1
wednesday 4 0
thursday 4 0
friday 2 0

BestTime
first day second best time for sport lesson

monday 4
tuesday 3
wednesday 4
thursday 4
friday 6

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.
Last edited on
Please don't keep spamming the forums with the same question.

Sorry!
Last edited on
Why this question is the same? Earlier I ask to help me to READ a Classes file and now I need an algorithm
Oh, OK. Sorry.
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.
main.cpp:152:62: error: invalid operands to binary expression ('int' and 'string'
(aka 'basic_string<char>'))
if( (p[i].ImtiDiena() == m[h].ImtiMokDiena() == t[v].ImtiTDienos() ) && (...
Ok I think i have fixed that problem
1
2
3
if((p[i].ImtiDiena() == m[h].ImtiSavDiena() == atoi(t[v].ImtiTDienos().c_str())) && (p[i].ImtiNr() == m[h].ImtiMokDiena()) && m[h].ImtiMokUzimtumas() == 0  &&  p[i].ImtiPamoka()=="x"){
					
				}

But is it correct?
Topic archived. No new replies allowed.