對不起,如果這是一個重複的問題,但我已經試圖尋找答案並空手而來。所以基本上我只想將字符串(單個單詞)添加到矢量的後面,然後將存儲的字符串顯示爲單個字符串。我是新秀。 #include <iostream>
#include <vector>
#include <string>
#include <cctype>
using namespace std;
int main(int a,
我有一個問題,當我定義了一個簡單的類稱爲「令牌」,即由兩個int值,我快速介紹從這個類中創建一個向量。我無法使用'push_back'。編譯器告訴我,我的「不名一型」 代碼示例我的類定義的 //例如 class token{
public:
int hi;
int hello;
token(int hi, int hello)
:hi(hi), hello(hello){}
};