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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <windows.h>
int main()
{
int counter, temp, done, c, d, temp2, temp3, total, totalcounter;
counter = 0;
for( done = 2; done != 1; done++)
{
int ary[1000];
printf("\n \n Enter your data \n ->:");
scanf("%i", &temp);
ary[counter] = temp;
counter = counter + 1;
printf("%d", done);
if (counter > 9)
{
for( temp3 = 2; temp3 != 1; temp3++)
{
printf("\nEnter 2 if you are finished entering data. \nEnter 1 if you have more data.\n ->:");
scanf("%i", &temp2);
if (temp2 == 2)
{
done = 0;
temp3 = 0;
}
else{
if (temp2 == 1)
{
temp3 = 0;}
else
printf("\nCould not understand imput\n");
}
}
}
}
printf("You have %d elements in your vector \n", counter);
//printing the elements of the array
printf("The elements are: \n");
totalcounter = counter;
while (totalcounter != 0)
{
temp = ary[totalcounter];
printf("%d", temp);
totalcounter = totalcounter -1;
}
return(0);
}
|