#include <iostream>
#include <cstring>
using namespace std;
int main(){
string s;
getline(cin, s);
string* token=strtok(s, " ");
while(token!=NULL){
cout << token << endl;
token = strtok(NULL, " ");
}
return 0;
}
Các bạn cho mình hỏi lỗi này là sao nhỉ?
9 29 E:\Code\2- C++\Buoi 8\8_01_Liet_ke_cac_tu_xuat_hien_trong_cau.cpp [Error] cannot convert 'std::string {aka std::basic_string<char>}' to 'char*' for argument '1' to 'char* strtok(char*, const char*)'
12 9 E:\Code\2- C++\Buoi 8\8_01_Liet_ke_cac_tu_xuat_hien_trong_cau.cpp [Error] cannot convert 'char*' to 'std::string* {aka std::basic_string<char>*}' in assignment