New to C++

Hi,
I am working on a couple C++ projectsfor my class. On one of my projects I get this error "identifier not found" for maximumValue. here is the code that I have done. I have got almost all the code from my text book..

// Three numbers.cpp : Defines the entry point for the console application.
//

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

int main()
{
// demonstrate maximum int value
int int1, int2, int3;

cout << "Input three interger values: ";
cin >> int1 >> int2 >> int3;

// invoke int version of maximum
cout << "The maximum integer is: "
<< maximumValue( int1, int2, int3 ) <<endl;
}
Please put your code in [code][/code] tags.

1
2
cout << "The maximum integer is: "
<< maximumValue( int1, int2, int3 ) <<endl;


You call function maximumValue, but you haven't defined that function.

http://www.cplusplus.com/doc/tutorial/functions/
Thank you for the link. Sorry I am new to this, so how do I put my code in tags?
I figured out how to place the code correctly..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Three numbers.cpp : Defines the entry point for the console application.
//

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

int main()
{
	// demonstrate maximum int value
	int int1, int2, int3;

	cout << "Input three interger values: ";
	cin >> int1 >> int2 >> int3;

	// invoke int version of maximum
	cout << "The maximum integer is: "
			<< maximumValue( int1, int2, int3 ) <<endl;
}


now to figure out how to define my function
1
2
3
4
5
6
#include <string>

std::string maximumValue(const int& val1, const int& val2, const int& val3)
{
     // Maximum value logic here.
}
Last edited on
Thank you all for your help.. I actually had to create a header file to get this application to work... :-)
Topic archived. No new replies allowed.