Help time machine code

I have to write a code that gives a time difference in minutes for a time machine that can move forward anytime between 24 hours. I was told I have various syntax errors but I'm not sure where exactly. I am new to this class so I would greatly appreciate the help.

#include "stdafx.h"
#include <iostream>
using namespace std;

int computeDifference(int hours, int minutes, bool isAM, int future_hours,
int future_minutes, bool future_isAM);

int main()
{
int hours, minutes, future_hours, future_minutes, total_time;
char isAM, future_isAM;
cout << "This time machine allows you to go forward in time, up to 24 hours.\n"
"To enter the proper number of minutes into the time machine, please enter a start time\n"
"Begin by entering the hour for the start time: " << endl;
cin >> hours;
cout << "Enter the minutes for the start time : " << endl;
cin >> minutes;
cout << "Enter A for AM or P for PM: " << endl;
cin >> isAM;
cout << "Now enter a future time. Begin by entering the hour for the future time : " << endl;
cin >> future_hours;
cout << "Enter the minutes for the future time : " << endl;
cin >> future_minutes;
cout << "Enter A for AM or P for PM: " << endl;
cin >> future_isAM;
total_time = computeDifference(hours, minutes, isAM, future_hours, future_minutes, future_isAM);
cout << "The total minutes between both given times is " << total_time << endl;
return 0;
}

int computeDifference(int hours, int minutes, bool isAM, int future_hours,
int future_minutes, bool future_isAM)

{
int convert_min, convert_future_min, total_difference;

convert_min = (hours * 60) + minutes;
convert_future_min = (future_hours * 60) + future_minutes;

if (isAM == future_isAM)
{
if (convert_min < convert_future_min)
total_difference = convert_future_min - convert_min;
else
total_difference = (convert_future_min + 1440) - convert_min;
return total_difference;
}
else
{
if ((isAM == "A") && (future_isAM == "P"))
if (hours == 12)
total_difference = (convert_future_min + 720) - minutes;
else
total_difference = (convert_future_min + 720) - convert_min;
else
if (future_hours == 12)
while (hours <= 12)
{
hours++;
}
total_difference = convert_min + future_minutes;
else
while (hours <= 12)
{
hours++;
}
total_difference = convert_min + convert_future_min;

return total_difference;
}

}
If you use code tags it would be possible to comment on a line of code instead of having to type it. Very helpful.

You need {} after your if and loop statements.
format your code, if you did, then use code tags when posting.
There are no comments
If your code won't run, there is a problem....
Learn how to read the output of your compiler
When you create pointers you need to set the value
http://www.cplusplus.com/doc/tutorial/pointers/

My compiler says there is a problem with lines 50 and 62
Since your code doesn't have brackets I'm not going to try and figure out your spaghetti code but it tells me
Line 62 [Error] 'else' without a previous 'if'

Topic archived. No new replies allowed.