似たような質問がたくさんあることは知っていますが、私は新人です。私の問題は、メイクファイルを作成してプロジェクトをコンパイルする必要があることですが、ある時点でエラーが返されます。
メイン.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);
および 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 エラー