将String转换为int并将结果存储在变量中

时间:2015-04-29 17:14:37

标签: c++ arrays methods

int Units;

void input(int i) {
    char temp[50];
    printf("Enter class id for #%d > ", i + 1);
    readLine(ClassID);      
    printf("Enter Name for #%d > ", i + 1);
    readLine(ClassName);        
    printf("Enter Description for #%d > ", i + 1);
    readLine(Description);      
    printf("Enter pre-reqs for #%d > ", i + 1);
    readLine(PreReqs);
    printf("Enter units > ");
    readLine(temp);
    // Write a method to convert String temp into an integer and store it in the Units field

我想我需要使用嵌套循环做一些事情,但我不确定如何进行转换请帮助。

0 个答案:

没有答案