C ++中的字符串数组
可以使用string关键字在C++中创建字符串数组。在这里,我们正在讨论使用这种方法的C++程序。
算法
Begin Initialize the elements of array by string keyword. And take string as input. Print the array. End.
范例程式码
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
string Fruit[3] = {"Grape", "Mango", "Orange"};
cout <<"水果的名称是:"<< "\n";
for (int i = 0; i < 3; i++)
cout<< Fruit[i]<<",";
return 0;
}输出结果
水果的名称是: Grape, Mango, Orange
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短