c++ - 错误 : could not deduce template argument

标签 c++ visual-c++

<分区>

这是我第一次使用 C++ 编程,应姐姐的要求,我正在创建一个 MultiplyBy999 应用程序。我在 MS Visual C++ 2010 Express Edition 中编写代码,但出现错误。代码:

#include "stdafx.h"
#include <iostream>


int main()
{
    using namespace std;
cout >> "Enter a number:" >> endl;
int x;
cin << x;
x = x * 999
cout >> "Output:" >> endl;
return 0;
}

最佳答案

  • 你混合了 << 和 >>
  • 很明显您混淆了 << 和 >>,但通常情况下,您应该始终将错误消息与您的问题一起粘贴。

    #include <iostream>
    using namespace std;
    
    int main()
    {
        cout << "Enter a number:" << endl;
        int x;
        cin >> x;
        x = x * 999;
        cout << "Output:" << endl;
        return 0;
    }
    

关于c++ - 错误 : could not deduce template argument,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12330193/

相关文章:

c++ - 将 fstreams 数组传递给函数?

c++ - 为什么 virtual 关键字会增加派生类的大小?

c++ - Visual C++ native 内存管理最佳实践

visual-c++ - 如何在makefile中创建目录

c++ - C++ 中的 T 类(您的定义)

c++ - 访问包含它的 vector 元素时,类对象的运算符重载不起作用?

c++ - 静态对象的奇怪输出

C++如何上下捕捉鼠标滚轮?

c++ - 是否可以使用与 2 个互斥体关联的 1 个条件变量(单独)

c++ - C/C++ 应用程序的新手设计注意事项