如题。
求求各位大佬解答一下为什么我的程序会崩溃。
代码如下:
#include <iostream>
#include <cstring>
#include <string>
#include <conio.h>
using namespace std;
int main(){
long a = 0;
long b = 1;
long c[b] = {};
char d = 'a';
while(true){
if(_kbhit()){
a = _getch();
if(a == 32){
cout << " ";
}
else if(a == 8){
system("cls");
c[b] == 0;
b--;
for(int n; n <= d; n++){
d = c[n];
cout << d;
}
}
else if(a == 13){
cout << "\n";
}
else{
c[b] = a;
d = c[b];
cout << d;
b++;
}
}
}
}
求求各位大佬解答一下为什么我的程序会崩溃。
代码如下:
#include <iostream>
#include <cstring>
#include <string>
#include <conio.h>
using namespace std;
int main(){
long a = 0;
long b = 1;
long c[b] = {};
char d = 'a';
while(true){
if(_kbhit()){
a = _getch();
if(a == 32){
cout << " ";
}
else if(a == 8){
system("cls");
c[b] == 0;
b--;
for(int n; n <= d; n++){
d = c[n];
cout << d;
}
}
else if(a == 13){
cout << "\n";
}
else{
c[b] = a;
d = c[b];
cout << d;
b++;
}
}
}
}