Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int MSLDF = 40;
- static size_t HEALTH;
- void duel(char *spells[8]) {
- char *variants[8];
- signed char health_action[8] = {2, 0, -1, -1, 0, -1, -1, 0};
- signed char health_variants[8] = {0, 0, 0, 0,
- 0, 0, 0, 0}; /*char ask_yn[1]="T";*/
- printf("Chose a spell:\n");
- for (int i = 0; i < 8; ++i) {
- printf("%s", spells[i]);
- }
- // This place of code work on linux gcc, but no in windows minGW
- unsigned char variants_index = 0;
- unsigned char health_action_index = 0;
- unsigned char health_variants_index = 0;
- for (int i = 0; i < 8; i++) {
- size_t string_size = strlen(spells[i]) + 1;
- if (string_size >= 2) {
- variants[variants_index] = spells[i];
- variants_index++;
- };
- if (string_size <= 2) {
- health_action[health_action_index] = 42;
- health_action_index++;
- };
- };
- for (int i = 0; i < 8; i++) {
- if (health_action[i] != 42) {
- health_variants[health_variants_index] = health_action[i];
- health_variants_index++;
- };
- }
- unsigned char ask_index = 0;
- scanf("%hhu", &ask_index);
- ask_index -= 1;
- printf("You have chosen\n%s", variants[ask_index]);
- HEALTH += health_variants[ask_index];
- printf("Your choise is:\n%s--Correct? (Y/N)--\n", variants[ask_index]);
- char ask_yn;
- scanf("%c", &ask_yn);
- printf("%c\n", ask_yn);
- if (ask_yn == 'Y')
- printf("Lalala\n");
- else {
- printf("Heyheyhey\n");
- }
- printf("%s", variants[2]);
- printf("Test\n");
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement