viewimage.php?id=3dafdf21f7d335ab67b1d1&no=29bcc427b38577a16fb3dab004c86b6fb8c469a51a456a5485032fed780bd3a4c8d4def1a6ca53d96a8165bbbe7b7eefcb5bd058b9da0bd93fe5ca8051e8610187

Run-Time Check Failure #2 - Stack around the variable 'A' was corrupted.


이 렇게 계속뜨는데

using namespace std;

void bubblesort(int list[], int last);

void bubbleup(int list[], int current, int last);


int main(){

int A[100];

ifstream ifman;

ifman.open("result.txt");

cout << "unsorted number: ";

for (int a = 0; a < 100; a++){

ifman >> A[a];

cout << A[a]<<" ";

}

cout << endl;

cout << "sorted number: ";

int last = 100;

bubblesort(A, last);

for (int i = 0; i < 100; i++)

cout << A[i]<<" ";


return 0;

}

void bubblesort(int list[], int last){

for (int current = 0; current < last; current++)

bubbleup(list, current, last);

return;


}

void bubbleup(int list[], int current, int last){

for (int walker = last; walker > current; walker--)

if (list[walker] < list[walker - 1]){

int temp = list[walker];

list[walker] = list[walker-1];

list[walker-1] = temp;

}

return;


result 텍스트파일에 저장된 숫자를 배열에저장하고 그 배열을 sort하는 프로그램인데


뭐가 잘못됫는지 계속저오류가뜨고..

값은맞게뜨는데 앞에 쓰레기값이 뜨는데;;


뭐가 잘못되었나요??