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 官宣新年祝福语简短