#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
#define SIZE 5
void select_word(const char *const art[], const char *const noun[],
const char *const verb[], const char *const prep[]);
void build_sentence(const char *const sentence[]);
int main()
{
int i;
const char *art [SIZE] = { "the", "a", "one", "some", "any",};
const char *noun[SIZE] = { "boy", "girl", "dog", "town", "car",};
const char *verb[SIZE] = { "drove","jumped", "ran", "walked", "skipped",};
const char *prep[SIZE] = { "to", "from", "over", "under", "on",};
srand(time(0));
for(i=0; i<3; i++)
select_word(art, noun, verb, prep);
return 0;
}
void select_word(const char *const art[], const char *const noun[],
const char *const verb[], const char *const prep[])
{
const char *sentence [6] = {
art [rand() % SIZE],
noun [rand() % SIZE],
verb [rand() % SIZE],
prep [rand() % SIZE],
art [rand() % SIZE],
noun [rand() % SIZE]};
build_sentence(sentence);
}
void build_sentence (const char *const sentence[]) {
printf("%s %s %s %s %s %s. \n",
sentence [0],
/* Я пытаюсь использовать функцию «toupper», чтобы первое слово в произвольно сгенерированном предложении было в верхнем регистре. Я думаю, что я положил функции PRINTF между предложением [0] и предложения [1] */Использование toupper function
sentence [1],
sentence [2],
sentence [3],
sentence [4],
sentence [5]);
}
Что вопрос? – user2407394
В чем вопрос? Это куча плохо отформатированного кода. –
Пожалуйста, перепишите это в форму вопроса, чтобы мы могли понять, в чем проблема, что у вас есть. –