Ok, So this isn't specific to classes, but since I have this thread open I'll go ahead and post it in here
I have a float being passed into a function. The float is a combination of two numbers, the first being year, second being date. I have it set up to be year.date, so say 1998.07 would be july 1998.
I need some help seperating the two though(if it's possible) This is what I have
Code:
float year, month;
year = yearMonth/1;
month = yearMonth % year;
where yearMonth is being passed into the function as something like 1998.07.
the error is as follows
Code:
136 C:\Dev-Cpp\add_data.cpp invalid operands of types `float' and `float' to binary `operator%'
Keep in mind that I'm getting this yearMonth number from inside of a different function, so I can't pass it as two seperate numbers(not that I can see anyway).
Any help is appreciated!
edit:
Also:
I'm trying to save the info that I get to a file. The file should be named by the number of the month in a folder by year.
Code:
dataFile.open("C:\\"year "\\"month".dat", ios::out);
gives the error
Code:
207 C:\Dev-Cpp\add_data.cpp invalid operands of types `const char[4]' and `float' to binary `operator+'
I don't get it, is there a way to have a dynamic file out location?