Jump to content


Error C2660


7 replies to this topic

#1 CollegeProginTraining

    New Member

  • Members
  • Pip
  • 4 posts

Posted 12 November 2006 - 03:53 AM

Hey everyone,
Another program problem on the rise. I need help please.
The code is:

#include<iostream>

#include<fstream>

using namespace std;


void hilo( int n, double & highest, double & lowest);


int main(){

	char filename[100];

	ifstream input;

	double h, l;

	do{

		cout << "Enter name of input file: ";

		cin >> filename;

		input.open(filename);

		if(!input.is_open()){

			cout << "Failed to open " << filename << "\nTry again\n";

		}

	}while(!input.is_open());

	hilo(h, l);

	cout << "Highest: " << h << endl;

	cout << "Lowest: " << l << endl;

	return 0;

}


void hilo(int n, double& highest, double & lowest){

	int number;

	highest = lowest = number;

	for (int i=1; i < n; i++){

		cout << "Enter number: ";

		cin >> number;

		if (number > highest)

			highest = number;

		else if (number < lowest)

			lowest = number;

	}

}


I am receiving a C2660 error that says it can't take 2 arguments and I have no idea what it means.
Any help is appreciated.

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 12 November 2006 - 05:50 AM

Here's a hint: examine the text of the error message.
You didn't post it (which would have been a good idea, as most people haven't memorized what 'C2660' is), but the message reads: "function does not take 'number' parameters". I really don't know how that could be clearer. It means you're calling a function with an incorrect number of parameters. The actual compiler output will also tell you which function it is and give you the line number that the error is on (which you didn't post either). You should look at that line and you will probably see how to fix the error. Here's a hint: you're calling a function with 2 parameters when it expects 3.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 dave_

    Senior Member

  • Members
  • PipPipPipPip
  • 584 posts

Posted 12 November 2006 - 11:04 AM

This line looks dodgy: highest = lowest = number;
Since you havent set number, you dont know what highest or lowest are going to be. You want highest to be numeric_limits<int>::min() and lowest = numeric_limits<int>::max()

#4 jeremy6996

    New Member

  • Members
  • PipPip
  • 25 posts

Posted 18 November 2006 - 06:16 AM

Reedbeta, i hate it when people like you insult people like that. please dont post on my threads if this is how your going to respond, If you noticed he is a new member.

#5 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 18 November 2006 - 08:29 AM

jeremy6996 said:

Reedbeta, i hate it when people like you insult people like that. please dont post on my threads if this is how your going to respond, If you noticed he is a new member.

I'll post in any thread I want to. And I don't care if he's a new member; he needs to show a certain level of initiative and common sense (like reading the error message!) in trying to understand his problems. Ignorance isn't a problem; everyone starts out knowing nothing. However, an unwillingness to learn or expectation that others will do a lot of the work for you is inexcusable.
reedbeta.com - developer blog, OpenGL demos, and other projects

#6 jeremy6996

    New Member

  • Members
  • PipPip
  • 25 posts

Posted 18 November 2006 - 03:16 PM

Redbeta I realy dont think he want's to be criticized and insulted, by insulting them you are helping them, yes but in a mean way!!! duhh

Like this line you wrote

I really don't know how that could be clearer. It means you're calling a function with an incorrect number of


hmm maby NOT INSULTING him would help!

#7 Jare

    Valued Member

  • Members
  • PipPipPip
  • 247 posts

Posted 18 November 2006 - 06:09 PM

Answering the badly written question perfectly, and giving advice about how to post questions more properly in the future, which will lead to the OP getting better and more useful help. Good job RB, I suppose no matter what you do, someone will complain.

#8 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 18 November 2006 - 06:09 PM

jeremy6996 said:

Redbeta I realy dont think he want's to be criticized and insulted, by insulting them you are helping them, yes but in a mean way!!!

I'm sorry but I have no patience for someone who does not seem to have even tried to understand the error message. Granted he is new to programming but since he's writing functions with parameters he ought to be able to understand an error message that says he's calling a function with the wrong number of parameters.
reedbeta.com - developer blog, OpenGL demos, and other projects





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users