#include %26lt;iostream%26gt;
using namespace std;
int main()
{
int myArray(10); // declare your array and size
/*
Create a loop to continuously ask for the user's input until
integer #10 is achieved
*/
for(int count = 0; count %26lt; myArray; count++)
{
// Prompt for input
cout %26lt;%26lt; "Type integer #" %26lt;%26lt; count + 1 %26lt;%26lt; ": ";
// Input to the specific array # specified by the variable "count"
cin %26lt;%26lt; myArray(count);
}
}
Write a program that will let the user type in 10 integer values and store them in an array using the C++?
#include%26lt;iostream.h%26gt;
#include%26lt;conio.h%26gt;
void main()
{
clrscr();
int num[10];
cout%26lt;%26lt;"Enter 10 numbers:";
for(int i=0;i%26lt;10;i++)
{
cin%26gt;%26gt;num[i];
}
cout%26lt;%26lt;"The stored elements of the array are:";
for(i=0;i%26lt;10;i++)
cout%26lt;%26lt;num[i];
getch();
}
Reply:no, i will not write the program, you should do it your self. but i'll write a harsh function in c of course:
int[10] array;
for(int i=0;i%26lt;10;i++)
{
cout%26gt;%26gt;type some words
cin%26lt;%26lt; %26amp;array[i];
}
// it'll do the basic function you ask.
// you should repair any function that doesn't work, because its been a while from the last time i wrote program in c++.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment