回答
他們工作在不同的字符類型:
std::cout
使用char
爲字符類型std::wcout
使用wchar_t
爲字符類型
否則兩個流寫到標準輸出。
但什麼是寬字符任何方式? –
'char'用於*窄*字符串,適用於7位ASCII和8位ANSI。 'wchar_t'用於* wide *字符串,也就是Unicode字符串。然而,'wchar_t'的大小是不可移植的,在某些系統上它是16位(適用於UCS2/UTF-16),其他系統則是32位(適用於UCS4/UTF-32)。 C++ 11引入了新的'char16_t'和'char32_t'類型來解決這個問題。 –
另一件事是,兩者都與尊重輸入流一起使用。
這些對象在第一次創建對象std::ios_base::Init
期間或之前被初始化。
std::cout
是std::basic_ios::tie
倒是到std::cin
並std::cerr
std:wcout
是std::basic_ios::tie
倒是到std::wcin
並std::wcerr
@Galik當然。感謝您的糾正。抱歉回覆晚了。 – oguzhanunlu
- 1. std :: transform和std :: for_each有什麼區別?
- 2. std :: function和std :: mem_fn有什麼區別
- 3. std :: invoke和std :: function有什麼區別?
- 4. std :: set和std :: vector有什麼區別?
- 5. std :: merge和std :: set_union有什麼區別?
- 6. std :: partial_sum和std :: inclusive_scan有什麼區別?
- 7. 「UTF-16」和「std :: wstring」有什麼區別?
- 8. std :: deque和boost:deque有什麼區別?
- 9. std :: move和unique_ptr :: reset有什麼區別?
- 10. lambda和std :: function有什麼區別?
- 11. std :: cout << x;和std :: cout << x << std :: endl;?
- 12. setbase(8)和std :: cout << std :: oct
- 13. std :: string :: c_str和std :: string :: data有什麼區別?
- 14. C++ std :: lock和std :: unique_lock之間有什麼區別?
- 15. std :: to_string,boost :: to_string和boost :: lexical_cast <std::string>有什麼區別?
- 16. std :: strtol和std :: stoi之間有什麼區別?
- 17. std :: condition_variable和std :: condition_variable_any之間有什麼區別?
- 18. -std = C++ 11和-std = gnu ++ 11之間有什麼區別?
- 19. std :: chrono和cout
- 20. std :: endl與cout和wcout一起工作嗎?
- 21. C++中的空std :: shared_ptr與空std :: shared_ptr有什麼區別?
- 22. 什麼是std :: cout << std :: cin做什麼?
- 23. 爲什麼我們需要綁定std :: cin和std :: cout?
- 24. 澄清使用std ::,std :: cout
- 25. xcode std :: wcout用wchar_t或std :: wstring!
- 26. std :: logical_not和std :: not1之間的區別?
- 27. std :: is_integer和std :: is_integral之間的區別?
- 28. std :: regex_match和std :: regex_search之間的區別?
- 29. C++中std :: unique_ptr和std :: shared_ptr的區別
- 30. std :: uninitialized_copy和std :: copy之間的區別?
標準流的瓦特版本爲** **瓦特IDE字符。 – NathanOliver