在一行中输入两个不同的值
2 different input value in 1 line
谁能帮助我如何做或获得2个输入,接受2个不同的值在同一时间。
图中红色方块M2是我输入的INPUT,那么如果我输入M1就会得到价格为10.50的Milk。
下面是示例输入
据我所知,您正在尝试使用一行或另一行的输入和输出。只需使用if语句就可以很容易地做到这一点。例如:
#include <iostream>
using namespace std;
int main() {
string INPUT;
cout << "The beginning of your code (the table, information, selection, and 'item selected:')";
cin >> INPUT;
if (INPUT == "possible inputs") {
cout << "Cash amount:" << price;
}
}
相关文章:
- 如何读取单个字符并在输入两个字符序列时输出? 使用 while 循环和C++
- 为什么这个scanf()的两个不同的输入会给出两个不同的输出?
- Cin 需要两个输入
- std::具有两个输入参数的矢量构造函数
- 有没有办法将两个输入图像堆叠到卤化物发生器中的单个 4 维缓冲区中?
- 如果两个输入流相等,我如何构造主()到输出是
- C 如何进行计数循环,该循环确定两个输入数字中的哪个是最低的,并且从那里计数
- C++ 验证同一行上两个输入的第一个
- 两个输入C++来自 Bash 的 cin
- ios_base::sync_with_stdio(false) 在来自标准输入的两个输入之间不起作用
- 我们可以在两个输入之间获得时间吗?
- 两个输入函数的 T(n) 运行时
- 两个输入进入一个 while 循环
- 在两个输入c++之间花费时间
- C++分隔两个输入
- 如何从同一输入获取两个输入 (C++)
- 在C++中记住具有两个输入的函数
- C++以不同的方式读取两个输入文件
- 当我试图查看我的数组时,前两个输入不出现
- 我正在尝试比较来自两个输入文件的数据,以查看一组是否比另一组少