cinとofsのところでエラーが出ています。
エラー(一部)
no operator ">>" matches these operands -- operand types are: std::basic_istream<char, std::char_traits<char>> >> <unknown-type>
no operator "<<" matches these operands -- operand types are: std::ofstream << std::vector<std::string, std::allocatorstd::string>
c++
1#ifndef _MCR_data 2#define _MCR_data 3 4#include <iostream> 5#include <fstream> 6#include <vector> 7#include <string> 8 9 10using std::cout; 11using std::cin; 12using std::string; 13using std::ofstream; 14using std::endl; 15using std::vector; 16using std::string; 17 18 19const int x=100; 20extern vector<string> strategy_data;//[]付けない 21extern vector<string> cause_data; 22extern vector<string> reflection_data; 23 24 25class MCR{ 26 27 string strategy_data_source; 28 string cause_data_source; 29 string reflection_data_source; 30 public: 31 void MCR_file_put(int flag); 32 void MCR_file_delete(); 33}; 34 35void MCR::MCR_file_put(int flag){ 36 if(flag == 1){ 37 cout << "MCR_strategy.txt in wite" << endl; 38 ofstream ofs("MCR_strategy.txt",std::ios::app); 39 cin >> strategy_data_source >> endl; 40 strategy_data.push_back(strategy_data_source); 41 ofs << strategy_data << endl; 42 43 } 44 if(flag == 2){ 45 cout << "MCR_cause.txt in wite" << endl; 46 ofstream ofs("MCR_cause.txt",std::ios::app); 47 cin >> cause_data_source >> endl; 48 cause_data.push_back(cause_data_source); 49 ofs << cause_data << endl; 50 51 } 52 if(flag == 3){ 53 cout << "MCR_reflection.txt in wite" << endl; 54 ofstream ofs("MCR_reflection.txt",std::ios::app); 55 cin >> reflection_data_source >> endl; 56 reflection_data.push_back(reflection_data_source); 57 ofs << reflection_data << endl; 58 59 } 60 61} 62 63 64 65 66 67#endif
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2019/02/24 04:50
2019/02/24 10:13
2019/02/24 11:39
退会済みユーザー
2019/02/25 13:02
2019/02/25 18:39