2017-01-07 9 views
-1

私はプログラムを書いており、それは長いプログラムであり、私はちょうど始めました。私はちょうどそれを実行するためにテストした、なぜそれはユーザー入力を持っていないことを教えてください:私のプログラムは入力を要求していません

#include <iostream> 
using namespace std; 
struct courses{ 
    int CLO1, CLO2, CLO3, CLO4, CLO5; 
    int tcounter; 
}; 
int main(){ 
    cin.clear(); 
    courses C1; 
    C1.CLO1; 
    C1.CLO2; 
    C1.CLO3; 
    int counter = 0; 
    char name; 
    cout << "Enter your Name: "; 
    cin >> name; 
    cout << "For C1, we have three CLOs that CLO1,CLO2 and CLO3. CLO1 and CLO3 are linked to PLO1 and CLO2 is linked to PLO2 " << endl; 
    cout << "Enter your marks in CLO1 for C1:(Out of 10) "; 
    cin >> C1.CLO1; 
    if (C1.CLO1 >= 5){ 
     counter++; 
    } 
    cout << "Enter your marks in CLO2 for C1:(Out of 10) "; 
    cin >> C1.CLO2; 
    if (C1.CLO2 >= 5){ 
     counter++; 
    } 
    cout << "Enter your marks in CLO3 for C1:(Out of 10) "; 
    cin >> C1.CLO3; 
    if (C1.CLO3 >= 5){ 
     counter++; 
    } 
    cout << counter; 
    return 0; 
} 
+2

なぜ、名前はstd :: stringではないのですか? – Jonas

答えて

0

私の1つとして、プログラムは問題ありません。あなたが変更する必要が 3つのこと:

  1. 文字から文字列
  2. C1.CLO1に名前の変数型; C1.CLO2; C1.CLO3。あなたのコードからこれらを削除しても意味がありません。
  3. 値を印刷して確認します。P
関連する問題