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 生日牌祝福语英语简短