时间:2021-07-01 10:21:17 帮助过:13人阅读
以下是关键代码
/* for (int i = 1; i <= n; i++) { res = mysql_query(&myCont, "INSERT INTO `i` (`id`, `name`, `age`, `subject`, `score`) VALUES ('3', 'C', '12', '英语', '100')");//查询 } */ //模板 for (int i = 1; i <= n; i++) { int id; /*char name[10]*/; int age; /*char subject[10]*/; int score; string name; string subject; cout << "intput id:"; cin >> id; cout << endl; cout << "input name:"; getline(cin, name); cout << "intput sge:"; cin >> age; cout << endl; cout << "input subject:"; getline(cin, subject); cout << "intput score:"; cin >> score; cout << endl; res = mysql_query(&myCont, "INSERT INTO `i` (`id`, `name`, `age`, `subject`, `score`)VALUES (id, 'name', age, 'subject', score)"); //VALUES('3', 'C', '12', '英语', '100')");//查询 }
res = mysql_query(&myCont, "INSERT INTO i
(id
, name
, age
, subject
, score
)VALUES (id, 'name', age, 'subject', score)");
现在问题就是这句怎么改