如何在c++中调用字符串中的特定字符

How to call a specific character from a string in C++?

本文关键字:字符 字符串 调用 c++      更新时间:2023-10-16

如何从这段代码中回忆起第四个字符并将其输出到屏幕上?

#include <iostream>
#include <string>
using namespace std;

int main () {
    cout << "Enter word: ";
    char random[99];
    cin >> random;
    \right here is where I would like to output the fourth character of the string "random"
    return 0;
}
cout << random[3];

考虑读一本关于c++的好书