我的程序不要求输入
My program is not asking for input
我正在编写一个程序,这是一个很长的程序,我刚刚开始。我刚刚测试了它的运行,请告诉我为什么它没有用户输入:
#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;
}
据我说,程序很好。您需要更改的三件事:
- 从字符到字符串的名称变量类型
- C1.氯1;C1.氯二;C1.氯3;从代码中删除这些没有任何意义。
- 打印值并选中:P
相关文章:
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- 无法在windows控制台中为C++程序提供必要的输入
- 更改.cpp程序的输入文件中数据的位置会意外更改输出
- 我试图制作一个程序,要求用户输入问题和答案,但程序循环不正确
- 我的程序没有从文件中读取并输入数据
- 3-3. 编写一个程序来计算每个不同单词在其输入中出现的次数
- 为什么有时我输入一个整数,程序将第一个输入的数字打印成十进制数?
- LLVM | codegen 用于带有命令行选项的程序输入功能
- 为什么当我输入较大的数字时,我的程序会到达文件末尾?
- 编写一个不断要求用户输入的程序
- 程序中的布尔函数返回输入的范围无论如何都是无效的
- 为什么我的程序在输入某个形状的面积的测量值后没有结束?
- 在这个无限循环中,当输入 0 时终止,当输入 int 范围之外的任何内容时,程序行为不正常
- 一个C++程序,用于在输入位数时输出具有特定位数的 .txt 文件中的所有数字
- 如何将输入C 程序的平均值输入
- Sudoku输入程序跳过提示
- 无法将文件输入 C++ 程序
- 简单的c++输入程序
- 简单输入程序崩溃
- 用户用于输入程序设置的文件约定