亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

typedef ostream_iterator< int, char, char_traits<char> >OUTIT; 那里錯了??

typedef ostream_iterator< int, char, char_traits<char> >OUTIT; 那里錯了??

UDUN 2015-12-17 14:16:00
//STL算法 #include<iostream> #include<vector> #include<algorithm> #include<functional> using?namespace?std; typedef?vector<int,?allocator<int>?>INTVEC; typedef?ostream_iterator<?int,?char,?char_traits<char>?>OUTIT; int?main() { int?a[10]?=?{?35,56,79,80,45,10,4,125,67,80?}; int?seed1?=?125; int?seed2?=?99; //以下演示排序算法sort()函數和復制算法copy()函數? INTVEC?vec1(a,?a?+?10); OUTIT?out(cout,?".");??//ostream_iterator(cout,".") cout?<<?"vec1?befor?sort(first,last)"?<<?endl; copy(vec1.begin(),?vec1.end(),?out); cout?<<?endl; sort(vec1.begin(),?vec1.end()); cout?<<?"vec1?after?sort(first,last)"?<<?endl; copy(vec1.begin(),?vec1.end(),?out); cout?<<?endl; //以下演示查找算法find()函數? vector<int>::iterator?iter1; iter1?=?find(vec1.begin(),?vec1.end(),?seed1); if?(iter1?==?vec1.end())?{ cout?<<?seed1?<<?"not?found?in?vector"?<<?endl; } else { cout?<<?seed1?<<?"found?in?vector"?<<?*iter1?<<?endl; } iter1?=?find(vec1.begin(),?vec1.end(),?seed2); if?(iter1?==?vec1.end())?{ cout?<<?seed2?<<?"not?found?in?vector"?<<?endl; } else { cout?<<?seed2?<<?"found?in?vector"?<<?*iter1?<<?endl; } system("pause"); return?0; } 錯誤提示: >f:\visual?studio?projects\project1\project1\源.cpp(8):?error?C2143:?語法錯誤:?缺少“;”(在“<”的前面) 1>f:\visual?studio?projects\project1\project1\源.cpp(8):?error?C4430:?缺少類型說明符?-?假定為?int。注意:?C++?不支持默認?int 1>f:\visual?studio?projects\project1\project1\源.cpp(16):?error?C2065:?“OUTIT”:?未聲明的標識符 1>f:\visual?studio?projects\project1\project1\源.cpp(16):?error?C2146:?語法錯誤:?缺少“;”(在標識符“out”的前面) 1>f:\visual?studio?projects\project1\project1\源.cpp(16):?error?C3861:?“out”:?找不到標識符 1>f:\visual?studio?projects\project1\project1\源.cpp(18):?error?C2065:?“out”:?未聲明的標識符 1>f:\visual?studio?projects\project1\project1\源.cpp(22):?error?C2065:?“out”:?未聲明的標識符 ==========?生成:?成功?0?個,失敗?1?個,最新?0?個,跳過?0?個?==========
查看完整描述

2 回答

已采納
?
DoDream

TA貢獻28條經驗 獲得超3個贊

少了#include <iterator>

查看完整回答
反對 回復 2015-12-21
?
UDUN

TA貢獻2條經驗 獲得超2個贊

謝謝,去看了一下這個網站,真的不錯!

查看完整回答
反對 回復 2015-12-25
  • 2 回答
  • 0 關注
  • 2131 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號