如何从数组 c++ 中的字符串打印第 N 个字符
How do you print an Nth character from a string in an array c++
我对编码很陌生,我只是有一个简短的问题。如何从 c++ 数组中的字符串中找到第 n 个字符?所以例如 {"Hey you" "echo" "lake" "lend" "degree"}
, n=0
等于"你好"谢谢!我不打算要求提供完整的代码,而只是关于从哪里开始的提示。
以下是一些示例:
unsigned int n = 3;
static const char hello[] = "hello";
cout << hello[n] << "n";
const std::string apple = "apple";
cout << apple[n] << "n";
static const char * many[] = {"These", "are", "many", "strings"};
cout << many[n][n] << "n";
cout << many[n] << "n";
相关文章:
- 打印字符数组地址的正确方法
- c ++控制台应用程序,如何在控制台外部打印字符
- 无法使用 swprintf 在 WCHAR* 中打印字符*
- 存储和打印字符,但输出不是预期的
- 如何使 printf 以与 NSLog 相同的方式打印字符缓冲区?
- 在带有 (void*) 强制转换的字符串中打印字符的内存地址
- C++无法打印字符变量
- 无法打印字符向量C++向量
- 为什么在编辑 fastq 文件并将输出写入新的 fastq 文件时引入不可打印字符?
- C :如何询问文件名并打印字符数组
- 循环中的 Cout 不会按定义的字符逐个打印字符
- (C++) 打印字符数组字符串的单词时出现问题
- 用putchar在屏幕上打印字符
- 在C 中使用继续语句的打印字符
- 在 for 循环 c++ 中打印字符
- 使用while和if递归打印字符
- 打印字符数组 c++
- 如何使用Xcode中的Unicode打印字符╔(和其他字符)
- cout.put() 是否推荐使用 cout<< 打印字符
- C++ 中的密码 |打印字符后删除字符