C++;cin打印变量时没有我的指示 介绍 我试图在C++中为BI/OCT/DEC/HEX号编写一个转换器。首先,我在控制台中打印一条消息,要求用户插入他想要进行的转换类型,然后是允许他输入转换的cin,然后我要求他输入数字,然后是允许他输入数字的cin 我的问题

C++;cin打印变量时没有我的指示 介绍 我试图在C++中为BI/OCT/DEC/HEX号编写一个转换器。首先,我在控制台中打印一条消息,要求用户插入他想要进行的转换类型,然后是允许他输入转换的cin,然后我要求他输入数字,然后是允许他输入数字的cin 我的问题,c++,input,cin,cout,C++,Input,Cin,Cout,我的问题是,在用户插入转换后,变量会在控制台上打印出来,而我不会告诉它 我试过的 我查看了文档,在他们的示例中,他们是这样做的: cout << "Please enter an integer value: "; cin >> i; cout << "The value you entered is " << i; cout << " and its double is " << i*2 << ".\n";

我的问题是,在用户插入转换后,变量会在控制台上打印出来,而我不会告诉它

我试过的 我查看了文档,在他们的示例中,他们是这样做的:

cout << "Please enter an integer value: ";
cin >> i;
cout << "The value you entered is " << i;
cout << " and its double is " << i*2 << ".\n";
输入

输出

预期产出:

附加说明
我应该提到,在这个版本的代码之前,我确实使用了
cout
来打印我的变量,看看它是否有效,但是我重新构建了几次代码,现在没有
cout代码是好的,要么清理并重新构建项目,要么它与打印值的项目/调试设置有关


尝试在发布模式下构建并运行程序。

尝试清理/重建项目。你的代码没问题。请发一个。请发一个。这包括一个可构建的程序、其输入、预期输出和实际输出,逐字逐句。这里的“打印我的变量”是指在键入字符时显示字符的终端吗?加上1表示问题的良好表示:)
#include <iostream>
#include <string>
using namespace std;
int main()
{
  string type;
  int n;
  cout << "Insert what type of conversion you want to make(binoct, bindec, binhex, octbin, octdec, octhex, decbin, decoct, dechex, hexbin, hexoct, hexdec): ";
  cin >> type;
  cout << "Insert the number you want to convert: ";
  cin >> n;
  return 0;
}
binoct
1001
 Insert what type of conversion you want to make(binoct, bindec, binhex,octbin, octdec, octhex, decbin, decoct, dechex,hexbin, hexoct, hexdec):binoct
 binoct
 Insert the number you want to convert:1001
 1001
Insert what type of conversion you want to make(binoct, bindec, binhex,octbin, octdec, octhex, decbin, decoct, dechex,hexbin, hexoct, hexdec):binoct
Insert the number you want to convert:1001