Search
 
SCRIPT & CODE EXAMPLE
 

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;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: make cin cout faster 
Cpp :: c++ generate random char 
Cpp :: c++ how to loop through a vector but not the last element 
Cpp :: how to complie with c++ 17 
Cpp :: qt change window title 
Cpp :: c++ round number down 
Cpp :: sort a vector of strings according to their length c++ 
Cpp :: get current date in c++ 
Cpp :: c++ example 
Cpp :: split vector in half cpp 
Cpp :: 2114. Maximum Number of Words Found in Sentences leetcode solution in c++ 
Cpp :: linked list with classes c++ 
Cpp :: cpp how to input a variable without hitting enter 
Cpp :: how to get a random number between two numbers in c++ 
Cpp :: qimage transformed 
Cpp :: make_move_iterator 
Cpp :: how to load from files C++ 
Cpp :: C++ Fahrenheit to Kelvin 
Cpp :: assign a struct to another c++ 
Cpp :: rotate in cpp 
Cpp :: c++ read file to char buffer 
Cpp :: Array implementation of Queue using class in c++ 
Cpp :: user defined key for map in c++ 
Cpp :: cpp float to int 
Cpp :: format c++ discord 
Cpp :: c++ check if string contains uppercase 
Cpp :: c++ initialize array with all zeros 
Cpp :: sum of vector elements c++ 
Cpp :: convert long int to binary string c++ 
Cpp :: prints out the elements in the array c++ 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =