About 877,000 results
Open links in new tab
  1. C++ : Creating an array with a size entered by the user

    Feb 20, 2015 · I was wondering if we can make an array with a size specified by the user. Ex: int a; cout<<"Enter desired size of the array"; cin>>a; int array[a]; The above program won't work …

  2. How to Take Input in Array in C++? - GeeksforGeeks

    Oct 5, 2023 · C++ Program to Take User Input in an Array using scanf() We can also use scanf() function to take input but then we have to specify the type of data and pass the address of the …

  3. How to User Input Array in Function in C++ - Delft Stack

    Feb 2, 2024 · The userInput is a function defined to get user input for the array size and elements. It declares an integer variable size to store the size of the array and then prompts the user to …

  4. Read user input into Array in C++ - C++ Programming Concepts

    Read user input into Array in C++ Syntax any_loop{ // Based on Array Size } //12 is Array Size for (i = 0; i < 12; i++) { // Reading User Input sales value Based on index cin >> sales[i]; //i is index }

  5. How to initialize array using user input? : r/cpp_questions - Reddit

    Apr 15, 2020 · If you want the array to be exactly the same size as the user inputs you have to dynamically allocate space for the arrays. Or just use a vector and it will manage the memory …

  6. Turning user input into an array - C++ Forum - C++ Users

    Apr 14, 2015 · However, dynamic arrays are able to be allocated from the heap at run-time with a, well, dynamic size. I'd do something like this: 1) Request user input. 3) Create a dynamic array …

  7. c++ - Is it possible to allow a user to enter an array size with a ...

    You might try the std::vector class instead and use the resize method, or pass the size through the constructor. Although, depending on what you need, maybe you can just let it grow …

  8. Size of char array decided by user input? - C++ Users

    Jun 27, 2015 · I want to declare a char array with not initial size. Later I will prompt the user to enter in a sentence. This input will be stored in the char array using getline. But how do I make …

  9. c++ - User Input into an Array - Stack Overflow

    Aug 30, 2015 · data[size] = input%10; input = input/10; if(input==0) break;//Escape if fewer characters than 5 entered. Remember that, index 0 will contain your smallest digit and index 5 …

  10. Taking Input in Arrays - read.learnyard.com

    This is what we'll study in this article: How to take input from the user for the values of the array elements. Let's see now how to take inputs from the user: Create an array of size 5, take its …

  11. Some results have been removed
Refresh