About 1,230,000 results
Open links in new tab
  1. How to input a string array in C++ - Stack Overflow

    Dec 4, 2013 · You should consider using std::vector<string> name;, rather than a fixed-size array, and adding names with push_back(), to avoid the ugly range checks in my code or the possibility of horrific stack-corruption bugs in yours.

  2. Array of Strings in C++ - GeeksforGeeks

    Feb 26, 2025 · The general syntax of array of strings is: string arr_name[size] where arr_name is the name assigned to the array and size is the desired size. Understanding how to create and manage arrays of strings is essential in C++. The C++ Course covers five different methods for creating arrays of strings, helping you choose the right approach for your ...

  3. c++ - How to input text into array of strings? - Stack Overflow

    Nov 19, 2012 · If you're reading from the standard input: int i = 0; for (string word; cin >> word; i++) names[i] = word; If you're reading from a string, use istringstream instead.

  4. Understanding C++ String Array - DigitalOcean

    Aug 4, 2022 · C++ provides us with ‘string’ keyword to declare and manipulate data in a String array. The string keyword allocates memory to the elements of the array at dynamic or run-time accordingly. Thus it saves the headache of static memory allocation of data-elements.

  5. how to store an input into an array? C++ - Stack Overflow

    Aug 3, 2011 · So you can get input into a string, instead, and the cout statements you wrote, should work. However, they will be char s and not ints, so you would be storing '1' and '0' instead of 1 and 0. Converting between them is easy, just use array[0]-'0' string array; cout << "Enter binary number: "; cin >> array; // Suppose the user inputs 10100.

  6. C++ User Input Strings - W3Schools

    User Input Strings. It is possible to use the extraction operator >> on cin to store a string entered by a user:

  7. How to Split a String into an Array in C++? - GeeksforGeeks

    Mar 4, 2024 · To split a string into an array of substrings in C++, we can use the std::istringstream class from the <sstream> library to create an input stream from the string. We can then split the string based on some delimiter using getline () and store them into the array of strings.

  8. Printing an array of strings through user input in C++

    Jan 5, 2022 · In this article, we will discuss the concept of Printing an array of strings through user input in C++. In this post, we are going to learn how to write a program to print array of strings (string elements in single dimensional array) using for, while and do-while loop in C++ language. Code to print Strings of an array

  9. String Array In C++ | Syntax, Methods & More (+Code Examples) …

    In this article, we will explore the concept of string arrays, learning how to declare, initialize, and manipulate them. We will also examine the different ways to create string array in C++, along with important programming examples. What Are Arrays Of Strings In C++?

  10. C++. Arrays of strings of type string. Examples - BestProg

    Dec 23, 2019 · This topic provides examples of solving the most common tasks with arrays of strings of type string. 1. Creating an array of strings of type string. Static and dynamic array of strings. 2. Initializing an array of strings of type string. Example. 3. An example of creating a dynamic array of strings of a given size. 4.

  11. Some results have been removed
Refresh