我几天前问过这个问题,但它并没有解决我的问题.我无法在Visual Studio中增加堆栈大小,我使用递归方法获得高输入并导致堆栈溢出.我不能使用矢量或其他东西.我需要的是在c ++,Visual Studio中增加堆栈大小.
PS我从Visual Studio配置增加了堆栈保留大小,但是,它也没有解决我的问题.
void sorting:: MergeSort(int *theArray, int n) {
mergesort(theArray, 0, n - 1);
}
void sorting::mergesort(int *theArray, int first, int last) {
if (first < last) {
int mid = (first + last) / 2; // index of midpoint
mergesort(theArray, first, mid);
mergesort(theArray, mid + 1, last);
// merge the two halves
merge(theArray, first, mid, last);
}
} // end mergesort
void sorting::merge(int* theArray, int first, int mid, int last) {
const int max_size = …Run Code Online (Sandbox Code Playgroud) 当我编译它时,它说学生格拉德斯没有初始化.有什么问题?
#include <iostream>
using namespace std;
int takeGrade1(int *grades) {
int i, noStudents;
cout << "No of students: ";
cin >> noStudents;
grades = new int[noStudents];
for (i = 0; i < noStudents; i++) {
cout << "Enter the grade: ";
cin >> grades[i];
}
return noStudents;
}
int main() {
int *studentGrades, no, i;
no = takeGrade1(studentGrades);
cout << endl << "Grades: " << endl;
for (i = 0; i < no; i++)
cout << studentGrades[i] << endl;
delete[]studentGrades; …Run Code Online (Sandbox Code Playgroud)