Generation

generate functionTue, 25 Apr 2023

solicitar al usuario un numero N de estaturas y las aguarde en un arreglo y luego pregunte que posicion desea consultar (del arreglo) y muestre el valor guardado

++ // define the size of the array int size = 0; std::cout << "Ingrese el numero de estaturas que desea almacenar:" << std::endl; std::cin >> size; // initialize the array int heights[size]; // fill the array for (int i = 0; i < size; i++) { int input = 0; std::cout << "Ingrese la estatura:" << std::endl; std::cin >> input; heights[i] = input; } // ask the user what index they want int index = 0; std::cout << "Que posicion desea consultar?:" << std::endl; std::cin >> index; // show the data to the user std::cout << "La estatura en la posicion " << index << " es: " << heights[index] << std::endl;

Want to kickstart your project?Use the new AI Studio to create your code