我想将push_back一个字符放入向量中并打印,但是我不知道为什么它没有被打印。
我不知道该怎么办,因为程序正在编译并返回0。
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<char> A(4);
char d = 's';
A.push_back(d);
// for(int i=0;i<3;i++)
{ cout << "first element is" << A[0]; }
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我进入CodeBlocks IDE的输出:
first element is
Process returned 0 (0x0) execution time : 0.444 s
Run Code Online (Sandbox Code Playgroud)