0

I believe that my program in the attached file is almost finished. When I try to run the program,there are two error message that pop up. The error are the following:

1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

1>c:\users\usr\documents\visual studio 2010\Projects\NEWLDIST\Debug\NEWLDIST.exe : fatal error LNK1120: 1 unresolved externals


If you happen to know what is missing or needs to be changed,I would greatly appreciate the advice.

This code is in C++ and I use MV C++ 2010 to run it

Attachments
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
	string GetDay();
	int GetStartTime();
	int GetEndTime();
	int GetLength(int _sTime, int _eTime);
	double ComputeRate(string _day, int _sTime, int _eTime, int _length);
	void DisplayErrorMessage();

void Main()
{
	string GetDay();
	int sTime;
	int eTime;
	int Length;
	double Rate;
	string Day;
	Day=GetDay();
	sTime=GetStartTime();
	eTime=GetEndTime();
	Length=GetLength( sTime, eTime);
	Rate=ComputeRate(Day,sTime,eTime,Length);
	system ("pause");
}

string GetDay()
    {
		string Day;
		cout<<"Please provide day of the week - ex. Mo Tu We ThFr Sa Su"<<endl;
		cin>> Day;
		system("cls");
		cout<<Day<<endl;
		transform(Day.begin(), Day.end(), Day.begin(), tolower);
		return Day;

    }
int GetStartTime()
    {
		int _sTime;
		cout<<"Please provide start time - ex. 1930,0120,1220"<<endl;
		cin>> _sTime;
		system("cls");
		cout<<_sTime<<endl;
		return _sTime;

    }
int GetEndTime()
    {
		int _eTime;
		cout<<"Please provide end time - ex. 1930,0120,1220"<<endl;
		cin>> _eTime;
		system("cls");
		cout<<_eTime<<endl;
		return _eTime;

    }
int GetLength(int _sTime, int _eTime)
    {
int sModTime = _sTime % 100;
int eModTime = _eTime % 100;
int sHour = (_sTime - sModTime) / 100;
int eHour = (_eTime - eModTime) / 100;
int differenceHours = eHour - sHour;
int differenceMinutes = eModTime - sModTime;
int length = (differenceHours * 60) + differenceMinutes;
cout<<length<<endl;
return length;
    }
void DisplayErrorMessage()
    {
		cout<<"InVailid Input";
    }
double ComputeRate(string _day, int _sTime, int _eTime, int _length)
    {
		double rate;
		if((_day.compare("mo")==0)||(_day.compare("tu")==0)||(_day.compare("we")==0)||(_day.compare("th")==0)||(_day.compare("fr")==0))
		{
			if(_sTime>=2100 && _sTime<0700)
			{
				rate=0.15*_length;
			}
			else if(_sTime<2100 && _sTime>=0700)
			{
				rate=0.30*_length;
			}
			else
			{
				DisplayErrorMessage();
	
			}

		}
		else if((_day.compare("sa")==0)||(_day.compare("su")==0))
		{
			rate=0.10*_length;
		}
		else
		{
			DisplayErrorMessage();
		}
		cout<<"The total cost of your phone call is"<<rate;
		return rate;
		system("pause");
	}
2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by DJSAN10
0

that does not seem to be the solution, It was already set to console in the first place

If you have read the entire thread you will find out that OP there actually changed it to Windows. I am not sure if this works though

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.