Answers for "How to make two dimensional string in c++"

C++
1

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] << "\n";
  	
  	cout << colour[0][0] << " " << colour[0][1] << "   :)" ; 
 
    return 0;
}
Posted by: Guest on March-27-2022

Code answers related to "How to make two dimensional string in c++"

Browse Popular Code Answers by Language