小编zTB*_*BxN的帖子

C++ if,else if和else语句问题

在一个简短的基本测试C++程序中,我使if,else if和else语句似乎不起作用.无论你输入if是什么答案,否则if和else语句只是自动跳转到else语句而我不明白为什么.我尝试了许多不同类型的方法来删除此错误,但似乎没有一种方法可行

#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main()
{
string name;
string feeling;
int age;

//IMPORTANT MESSAGE
cout << "THIS PROGRAM IS CAPS/SLANG SENSITIVE!" << endl << endl;
//IMPORTANT MESSAGE

cout << "Hello User, please enter name: ";
cin >> name;
cout << endl << endl;

cout << "Now please enter your age: ";
cin >> age;
cout << endl << endl;

cout << "Hello " << name << ", you are " << age …
Run Code Online (Sandbox Code Playgroud)

c++ if-statement

2
推荐指数
1
解决办法
2765
查看次数

标签 统计

c++ ×1

if-statement ×1