나는 이것이 약간의 치료법이라는 것을 알고 있지만 내 문제를 이해할 수없는 것 같습니다. 아마도 인수의 매개 변수와 관련이 있지만 확실하지 않습니다.
void Input (int **&x, int *&arr, int &size1,int &size2, int a, int b)
{
cout << "Please enter 2 non-negative integer values: "<< endl;
cout << "1. ";
cin >> size1;
int checkVal(int size1, int a);
cout << "2. ";
cin >> size2;
int checkVal(int size2, int b);
void putArr(int **&x,const int &size1,const int &size2);
arr[0] = size1;
arr[1] = size2;
}
int checkVal (int &size, int x)
{
do{
if (size < 0)
cout << size << " is not a non-negative integer. Re-enter --> " << x << ". ";
cin >> size;
}while(size < 0);
return size;
}
void summation(int ***&y, int *&arr)
{
int *size = new int;
*size = **y[0] + **y[1];
y[2] = new int *(size);
*(arr + 2) = *size;
delete size;
}
int main()
{
int size, size1, size2;
int a = 1, b = 2;
int** x;
int*** y;
int** q;
int**** z;
int *arr[2];
allocArr(x, y, q, z);
Input(x, arr, size1, size2, a, b);
checkVal(size);
putArr(x, size1, size2);
summation(y, arr);
display(z);
}
이 세 가지 기능 모두에서 문제가 발생합니다. 나는 꽤 혼란스러워. 미리 감사드립니다.
의도 된 목적을 알 수없는 별은 언급하지 않고 여러 곳에 다음과 같은 코드가 있습니다.
cin >> size1;
int checkVal(int size1, int a);
cout << "2. ";
여기서 checkVal
호출하지 않고 function을 선언 합니다. 이 특별한 경우에 나는 그것을 대체해야한다고 믿습니다.
cin >> size1;
cout << "2. " << checkVal(size1, a);
(올바른 유형의 인수를 제공 한 경우)
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다