小编Arv*_*ios的帖子

C++ char或逻辑运算符?如果正确,为什么要使用其他{...}?

        #include <iostream>

                int main()
                {
                    char username[15];
                    char password[15];


                    std::cout << "Hello, please login to continue your action.<Max 15 Char>" << std::endl;
                    std::cout << "Username: ";
                    std::cin >> username;
                    std::cout << "Password: ";
                    std::cin >> password;

                    if (username == "User" && password == "qwerty")
                    {
                        std::cout << "Hello, creator.";
                    }
                    else 
                    {
                        std::cout << "Invalid Login";
                    }
/*23 row*/          std::cout << std::endl << std::endl << "Username=" <<username << std::endl << "Password=" << password;

                    std::cout << std::endl << std::endl << "Press …
Run Code Online (Sandbox Code Playgroud)

c++

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

在readed之前更改标识符的后缀?

我真的不知道后缀.我知道它首先使用标识符然后增加或减少,如第一次显示i然后++.但现在我认为我错了,仍然不明白.

#include <iostream>

using namespace std;

int main()
{
    int i = 0;
    cout << i << i++ << i;
    cout << "\n\n\nPress Enter to close the window . . . ";
    cin.clear();
    cin.sync();
    cin.get();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

输出:

101


Press Enter to close the window . . . 
Run Code Online (Sandbox Code Playgroud)

首先i在增量加入之前改变.为什么?

我期望

001

Press Enter to close the window . . .
Run Code Online (Sandbox Code Playgroud)

有人可以解释.

c++

0
推荐指数
1
解决办法
80
查看次数

标签 统计

c++ ×2