CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
C++ Code, to Read 1000 strings, and stop, when a string is repeated in input.
Created for Jimmy Pub in thread - https://www.sololearn.com/Discuss/740500/help-with-dynamic-matrix
*/
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
char* * arr = new char* [1000];
/// Declare a char* array of 10000 elements.
/// char* = C-String.
/// Thus, it_is_an array_of strings.
for(int i=0;i<1000;i++)
{
arr[i] = new char[1000];
/// Initialize Memory for each string, 1000 elements each.
/// We_need_to_do_this so_that_we can use the elements
}
int ctr = 0; /// Our String Counter.
/// Will store the number of strings unmatched.
while(true)
{
cin.getline(arr[ctr],100);
/// Get a String.
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run