HELP!: Basic user Interface Program with methods

I keep getting an error message of:
1>------ Build started: Project: CIS247_WK1_Lab_Shorts, Configuration: Debug Win32 ------
1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1>C:\Users\610pawn\Documents\Visual Studio 2010\Projects\CIS247_WK1_Lab_Shorts\Debug\CIS247_WK1_Lab_Shorts.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


my code is:

// Program Header
// Program Name: Basic User Interface
// Programmer: Alicia Shorts
// CIS247C, Week 1 Lab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Program Description: A basic interface program that uses user-defined methods.

#include<iostream>
#include<string>
#include<stdlib.h>
using namespace std;

int atoi( const char * str);
double atof (cont char * str);

int main()
{
	string input= "";
	string name= "";
	int age=0;
	double mileage=0.0;

	void DisplayApplicationInformation();
	void DisplayDivider("Start Program");
	void DisplayDivider("Get Name");
	name = GetInput("Alicia Shorts");
	cout << " Your name is:" << name << endl;
	void DisplayDivider("Get Age");
	age = atoi(input.c_str());
	cout << " \nYour age is:" << age;
	void DisplayDivider("Get Mileage");
	input = GetInput("mileage");
	mileage = atof( input.c_str());
	cout << "\n Your car MPG is:" << setprecision(2)<< fixed << mileage<<  endl;
	TerminateApplication();



return 0;
system("pause");



}


void DisplayApplicationInformation()
{
	cout << " Welcome to the Basic User Interface Program /n" << endl;
	cout << " CIS247, Week 1 Lab \n" << endl;
	cout << " Name: Alicia Shorts \n" << endl;
	cout << " This program accepts user input as a string, then makes the appropiate data conversion" << endl;

}

DisplayDivider(string outputTitle)
{
	cout << "********************" << outputTitle << "********************"<< endl;
	
}

void DisplayDivider(string message)
{
	name = GetInput("Alicia Shorts");
	cout << " Your name is:" << name << endl;


    age = atoi(input.c_str());
	cout << " \nYour age is:" << age;


	input = GetInput("mileage");
	mileage = atof( input.c_str());
	cout << "\n Your car MPG is:" << setprecision(2)<< fixed << mileage<<  endl;
}

GetInput(string inputType)
{
	string mystring;
	cout << " Please enter your" << message;
	getline(cin, mystring);
	return mystring;


}
TerminateApplication()
{
	cout << " Thank you for using the Basic User Interface program!" << endl;
}
Last edited on
Its quite hard to get people to help you with link errors, you know you spelt iostream wrong in your include, I dont think thats your only problem though... I will keep looking whats going on with standared lib.h I have never had to use that with the code your using?

you mixing c with c++?

you know you got to build header files and add them to the project, I know thats a built in lib but im confused...maybe im no help :/ sry
Last edited on
WOW a simple mistake, thank you for that atleast!
Still get the same error though hmm..
Last edited on
you also seem to have functions with no type, 2 functions with the same name and should be same return type even though 1 is missing the type and you should normally declare them before main or use a function prototype.
I am going to re-write this code and post it if it doesn't work also.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Program Header
// Program Name: Basic User Interface
// Programmer: Alicia Shorts
// CIS247C, Week 1 Lab
// Program Description: A basic interface program that uses user-defined methods.

#include<iostream>
#include<string>
#include<stdlib.h>
using namespace std;

void displayApplicationInformation(void);
void getInput(string);
void displayDivider(string);
void terminateApplication(void);


int main()
{
	string input= "";
	string name= "";
	int age=0;
	double mileage=0.0;
    int atoi( const char * str);
    double atof (cont char * str);

	void displayApplicationInformation(void);
	void displayDivider("Start Program");
	void displayDivider("Get Name");
	name = getInput("Alicia Shorts");
	cout << " Your name is:" << name << endl;
	void displayDivider("Get Age");
	age = atoi(input.c_str());
	cout << " \nYour age is:" << age;
	void displayDivider("Get Mileage");
	input = getInput("mileage");
	mileage = atof( input.c_str());
	cout << "\n Your car MPG is:" << setprecision(2)<< fixed << mileage<<  endl;
	void terminateApplication(void);



return 0;
system("pause");



}


void displayApplicationInformation()
{
	cout << " Welcome to the Basic User Interface Program /n" << endl;
	cout << " CIS247, Week 1 Lab \n" << endl;
	cout << " Name: Alicia Shorts \n" << endl;
	cout << " This program accepts user input as a string, then makes the appropiate data conversion" << endl;

}

displayDivider(string outputTitle)
{
	cout << "********************" << outputTitle << "********************"<< endl;
	
}

void displayDivider(string message)
{
	name = getInput("Alicia Shorts");
	cout << " Your name is:" << name << endl;


    age = atoi(input.c_str());
	cout << " \nYour age is:" << age;


	input = getInput("mileage");
	mileage = atof( input.c_str());
	cout << "\n Your car MPG is:" << setprecision(2)<< fixed << mileage<<  endl;
}

getInput(string inputType)
{
	string mystring;
	cout << " Please enter your" << message;
	getline(cin, mystring);
	return mystring;


}
void terminateApplication(void)
{
	cout << " Thank you for using the Basic User Interface program!" << endl;
}
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Program Header
// Program Name: Basic User Interface
// Programmer: Alicia Shorts
// CIS247C, Week 1 Lab
// Program Description: A basic interface program that uses user-defined methods.

#include<iostream>
#include<string>
#include<stdlib.h>
using namespace std;

void DisplayApplicationInformation();
void DisplayDivider(string);
void GetInput(string);
void TerminateApplication();


int main()
{
	string input;
string name;
int age;
double mileage;

DisplayApplicationInformation();
DisplayDivider("Start Program");
DisplayDivider("Get Name");

name = GetInput("name");
cout<<"\nYour name is: " << name;

DisplayDivider("Get Age");
input = GetInput("age");
age = atoi( input.c_str() );
cout<<"\nYour age is: " << age;

DisplayDivider("Get Mileage");
input = GetInput("mileage");
mileage = atof( input.c_str() );
cout<<"\nYour car MPG is: "<<mileage;

TerminateApplication();

return 0;	
system("pause");



}


void DisplayApplicationInformation()
{
	cout << " Welcome to the Basic User Interface Program /n" << endl;
	cout << " CIS247, Week 1 Lab \n" << endl;
	cout << " Name: Alicia Shorts \n" << endl;
	cout << " This program accepts user input as a string, then makes the appropiate data conversion" << endl;


}

void DisplayDivider(string outputTitle)
{
	cout << "********************" << outputTitle << "********************"<< endl;
	return outputTitle;
}



void GetInput(string inputType)
{
	string mystring;
	cout << " Please enter your" << message;
	getline(cin, mystring);
	return mystring;


}
void TerminateApplication()
{
	cout << " Thank you for using the Basic User Interface program!" << endl;
	return 0;
}



New code same error message I don't get it....
Topic archived. No new replies allowed.