Lol, this is driving me bonkers! Ok, I made my own header:
and my function:
Yeah it is supposed to convert hours, minutes, and seconds for both entries into just seconds. Then subtract second entry from first entry to get the difference of seconds between the two...
However, I get "int Seconds: redefinition. See declaration of 'Seconds'" error. Where on earth am I defining seconds twice? I only define it once in the header... Yeah, I don't get what my error is here. If the compiler could be a little more specific... but unfortunately it seems it was built to give you very vague messages. (Visual Studio).
Does anyone know what the issue might be?
Thanks.
#include <stdio.h> int totalSeconds(int a, int b, int c) { int Seconds, Seconds = (a * 60 * 60) + (b * 60) + c; return Seconds; }
and my function:
//calculates total seconds of hours, minutes, and seconds it has been since 12 of both sets of numbers entered. //Then subtracts first number of seconds from the second number of seconds. #include <stdio.h> #include <conio.h> #include "Total seconds.h" int main() { int Diff, h, m, s, h1, m1, s1; printf("Enter the first time as three integers: "); scanf("%d %d %d", &h, &m, &s); printf("Enter the second time as three integers: "); scanf("%d %d %d", &h1, &m1, &s1); Diff = totalSeconds(h1, m1, s1) - totalSeconds(h, m, s); printf("The difference between the the times is %d seconds", Diff); getch(); return(0); }
Yeah it is supposed to convert hours, minutes, and seconds for both entries into just seconds. Then subtract second entry from first entry to get the difference of seconds between the two...
However, I get "int Seconds: redefinition. See declaration of 'Seconds'" error. Where on earth am I defining seconds twice? I only define it once in the header... Yeah, I don't get what my error is here. If the compiler could be a little more specific... but unfortunately it seems it was built to give you very vague messages. (Visual Studio).
Does anyone know what the issue might be?
Thanks.