因此,此代码用于以任何随机顺序输入命令输入,它将返回输入后的值.Amt_Range是一个数字检查功能.
为什么这样做.它应该能够由于指针的比较.
更重要的是string()做了什么.根据我的有限理解,比较不应该起作用,因为交流样式字符串的形式为' - ''t'.提前致谢!!
int main(int argc, const char *argv[]) {
string dummy;
int tests = 0, quizzes = 0, assignments = 0, labs = 0, fin = 0;
int testweight = 0, quizweight = 0, assignweight = 0, labweight = 0, finweight = 0;
int counter = 1;
if (argv[counter] == string("-t")) {
dummy = argv[counter + 1];
tests = Amt_Range(dummy, "tests");
counter+=2;
} else if (argv[counter] == string("-q")) {
dummy = argv[counter + 1];
quizzes = Amt_Range(dummy, …Run Code Online (Sandbox Code Playgroud)