眾所周知C++可以通過iostream的cout和cin或者通過cstdio(stdio.h)的printf()和scanf()來進行輸入輸出,可是最近使用iostream時,出現了問題,一個測驗的小代碼如下:
# include <iostream> //報錯問題就出在這里,匯入iostream時報的錯,因為下一行設定過斷點還是錯,所以是這里的問題
using namespace std;
int main()
{
int number;
cout<<"Please input a number:"<<endl;
cin>>number;
cout<<"You had inputted "<<number<<" just now!"<<endl; //一個很簡單的輸入輸出程式
return 0;
}
運行后報錯

,還打開了另外一個程式,應該是iostream里面的。我的C++編譯器(DevC++)說那里面有錯,程式報錯部分如下:
template<>
class allocator<void>
{
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef void* pointer;
typedef const void* const_pointer;
typedef void value_type;
template<typename _Tp1>
struct rebind
{ typedef allocator<_Tp1> other; };
};
/**
* @brief The @a standard allocator, as per [20.4].
*
* See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt04ch11.html
* for further details.
*/
template<typename _Tp>
class allocator: public __glibcxx_base_allocator<_Tp> //這里報錯,它說expected'{'before'<'token
{
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
typedef _Tp value_type;
template<typename _Tp1>
struct rebind
{ typedef allocator<_Tp1> other; };
allocator() throw() { }
allocator(const allocator& __a) throw()
: __glibcxx_base_allocator<_Tp>(__a) { }
template<typename _Tp1>
allocator(const allocator<_Tp1>&) throw() { }
~allocator() throw() { }
// Inherit everything else.
};
我就很納悶,iostream庫還能有錯???

后來測驗發現,iomanip庫也不行,都是上面這個程式的問題,且問題相同。
我懷疑我的Dev-C++版本問題,以前我用的版本不記得了,可能是5.2幾,現在更新變成了5.11幾。求助各位大佬們,這里是不是出問題了?

求助各位大佬!!!望回答,謝謝!!!


轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/263053.html
標籤:C++ 語言
上一篇:為什么編譯成功運行不出來
下一篇:IBMinfo78請進
