建立了一个BF虚拟机进行操作 不知道为什么炸了
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int memory[20000]={},ptr=10000;
string s=",>,[-<+>]<.";
//cin>>memory[10000];
//cin>>memory[10001];
//while(memory[10001]){
// memory[10001]--,memory[10000]++;
//}
//cout<<memory[10000]
for(int i=0;i<s.size();i++){
if(s[i]=='>') ptr++;
else if(s[i]=='<') ptr--;
else if(s[i]=='+') memory[ptr]++;
else if(s[i]=='-') memory[ptr]--;
else if(s[i]=='.') cout<<memory[ptr];
else if(s[i]==',') cin>>memory[ptr];
else if(s[i]=='['){
if(memory[ptr]==0){
i++;
while(s[i]!=']'&&i<s.size()) i++;
}
}
else if(s[i]==']'){
if(memory[ptr]){
i--;
while(s[i]!='['&&i>=0) i--;
}
}
}
}
求大佬