#include
#include
#include
using namespace std;
int main(){
string article [] = {"the" ,"a" ,"one" ,"some" ,"any" };
string noun [] = {"boy" ,"girl" ,"dog" ,"town" ,"car" };
string verb [] = {"drove","jumped","ran" ,"walked","skipped"};
string preposition[] = {"to" ,"from" ,"over","under" ,"on" };
srand(time(0));
string sentence[] = {article[rand()%5], noun[rand()%5], verb[rand()%5], preposition[rand()%5], article[rand()%5], noun[rand()%5]};
for(int i = 0; i<6; i++) {
cout<}
}
你的代码很多都都可以简化
。c++是 面向对象编程吗?
我记得c没有string这个数据类型吧。
贴处错误来看看。