Hello I have been working on this code for my class and just not sure what the errors mean or how to fix them. Also I am not sure what the next step is that I need to take or how I even finish the program.. I have only been using c++ for a month and not very familiar with any of it. Thank you in advance for all of the help!
error LNK2019: unresolved external symbol "int __cdecl parseDate(class std::basic_string,class std::allocator >)" (?parseDate@@YAHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main : fatal error LNK1120: 1 unresolved externals
so my assignment is... A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $10.00. People who park their cars for longer than 24 hours will pay $8.00 per day. Write a program that calculates and prints the parking charges. The inputs to your program are the date and time when a car enters the parking garage, and the date and time when the same car leaves the parking garage. Both inputs are in the format of YY/MM/DD hh:mm
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <sstream>
usingnamespace std;
string startDateString;
string endDateString;
string dateStr;
int parseDate( string dateStr );
int main ()
{
string enter_date;
string enter_time;
string exit_date;
string exit_time;
cout << "Please enter the date and time the car is entering "<< endl
<< "the parking garage in the following format: YY/MM/DD hh:mm"<< endl;
getline (cin,dateStr);//cin >> enter_date >> enter_time;
cout<< "Please enter the date and time the car is exiting "<< endl
<< "the parking garage in the following format: YY/MM/DD hh:mm"<< endl;
getline (cin,dateStr);//cin >> exit_date >> exit_time;
{
// Format: YY/MM/DD hh:mm
int year = atoi( dateStr.substr( 0, 2 ).c_str() );
int month = atoi( dateStr.substr( 3, 2 ).c_str() );
int day = atoi( dateStr.substr( 6, 2 ).c_str() );
int hour = atoi( dateStr.substr( 9, 2 ).c_str() );
int min = atoi( dateStr.substr( 12, 2 ).c_str() );
// Now calculate no. of mins and return this
int totalMins = 0;
totalMins += ( year * 365 * 24 * 60 );
totalMins += ( month * 30 * 24 * 60 );
totalMins += ( day * 24 * 60 );
totalMins += ( hour * 60 );
totalMins += ( min );
return totalMins;
}
int startTime = parseDate( startDateString );
int endTime = parseDate( endDateString );
int elapsedTime = endTime - startTime; // elapsedTime is no. of minutes parked
return 0;
}