Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

How to make two dimensional string in c++

// C++ program to demonstrate array of strings using
// 2D character array
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    // Initialize 2D array
    string colour[4] = { "Blue", "Red", "Orange",
                           "Yellow" };
 
    // Printing Strings stored in 2D array
    for (int i = 0; i < 4; i++)
        std::cout << colour[i] << "
";
  	
  	cout << colour[0][0] << " " << colour[0][1] << "   :)" ; 
 
    return 0;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #How #dimensional #string
ADD COMMENT
Topic
Name
7+2 =