비슷한 질문이 많이 있음을 알고 있지만 너무 새롭습니다. 그래서 내 문제는 내가 makefile을하고 내 프로젝트를 컴파일해야하지만, 어떤 시점에서 그것은 오류를 반환합니다.오류 : 함수에 인수가 너무 적습니다.
는하여 Main.cpp
#include <iostream>
#include <stdlib.h>
#include "SquareRootCalculation.h"
using namespace std;
int main(int argc, char* argv[])
{
int number = atoi(argv[0]);
int th = atoi(argv[1]);
float result = SquareRoot(number, th);
return 0;
}
InitialGuess.cpp
#include <iostream>
#include <math.h>
using namespace std;
int InitialGuess(int number)
{
float numberLength = 0;
for(; number != 0; number /= 10, numberLength++);
float n = nearbyint(sqrt(numberLength));
float y = numberLength * pow(10, n);
return 0;
}
SqrtCalc.cpp
#include <iostream>
#include "InitialGuess.h"
#include <math.h>
using namespace std;
int SquareRoot(int number, int th, float y)
{
int initialGuess = InitialGuess(y);
float x = initialGuess;
for (int k=1; k< th; ++k)
{
x = (x + (number/x))/2;
}
cout<<x;
return 0;
}
도 나는 InitialGuess.h
int InitialGuess(int number, float y);
이 1,515,
및 sqrtcalc.h
int SquareRoot(int number, int th);
및 메이크
all:
g++ Main.cpp InitialGuess.cpp SquareRootCalculation.cpp -o FR
이것은이 점에서 오류를
InitialGuess.h 1 In function 'int SquareRoot (int,int,float)'
InitialGuess.h "too few arguments 'int InitialGuess(int, float)'
SqrtCalc 7 에러를 반환