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
|
#include "stdafx.h"
#include <stdio.h>
char * array1[10];
char * array2[10];
char car[10];
char car1[10];
char car2[10];
char car3[10];
char car4[10];
char car5[10];
char car6[10];
int int1;
int main()
{
printf("We're making a list now~\n");
fgets(car, 10, stdin);
fgets(car1, 10, stdin);
fgets(car2, 10, stdin);
fgets(car3, 10, stdin);
fgets(car4, 10, stdin);
fgets(car5, 10, stdin);
fgets(car6, 10, stdin);
array1[1] = car;
array1[2] = car1;
array1[3] = car2;
array1[4] = car3;
array1[5] = car4;
array1[6] = car5;
array1[7] = car6;
printf("The whole array is\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n", array1[1], array1[2], array1[3], array1[4], array1[5], array1[6], array1[7]);
printf("Now select which one to choose!: ");
scanf_s("%d", &int1);
if (int1 < 1 || int1 > 7) {
printf("Invalid number!");
exit();
}
else {
char ch1[32];
int change;
char change2[32];
printf("Number %d of the array 1 is %s", int1, array1[int1]);
printf("Would you like to change %d in Array1?\n", int1);
fgets(ch1, 32, stdin);
if (ch1 == "yes" || "Yes" || "YES" || "y") {
printf("Enter what to change it to: ");
fgets(change2, 32, stdin);
array1[int1] = change2;
printf("Space %d in Array1 is now %s", int1, array1[int1]);
getch();
}
else {
printf("You said no!");
getch();
}
}
return 0;
}
|