- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Array of Strings in C++
Array of strings can be created in C++ using string keyword. Here we are discussing a C++ program by using this approach.
Algorithm
Begin Initialize the elements of array by string keyword. And take string as input. Print the array. End.
Example Code
#include<iostream> #include<bits/stdc++.h> using namespace std; int main() { string Fruit[3] = {"Grape", "Mango", "Orange"}; cout <<"The name of fruits are:"<< "\n"; for (int i = 0; i < 3; i++) cout<< Fruit[i]<<","; return 0; }
Output
The name of fruits are: Grape, Mango, Orange
Advertisements
To Continue Learning Please Login
Login with Google