Question
A group of students at UC Davis is about to start a Study Abroad program in France, over the summer. They need to quickly learn
A group of students at UC Davis is about to start a Study Abroad program in France, over the summer. They need to quickly learn a bit a French so that they can interact with people.
It would therefore be very helpful if they had access to a program that shows some of the verb conjugations, first starting with the easiest group of verbs: the verbs ending in -er.
For donner, which means to give in its infinitive form, is conjugated as follows:
Je donne (I give)
Tu donnes (You give)
Elle/Il donne (She/He gives)
Nous donnons (We give)
Vous donnez (You give formal form)
Elles/Ils donnent (They give)
As you can observe, the suffix -er is first removed from the infinitive form and then a specific ending is added to the verbs root according to the given pronoun.
Write program conjugueur.c that receives an -er French verb from the user and conjugates it accordingly, as illustrated in the following example.
$ ./conjugueur Enter a French verb (-er): donner je donne tu donnes elle/il donne nous donnons vous donnez elles/ils donnent Conjugate another verb? [Yy] y Enter a French verb (-er): parler je parle tu parles elle/il parle nous parlons vous parlez elles/ils parlent Conjugate another verb? [Yy] n $ ./conjugueur Enter a French verb (-er): savoir Not a correct -er verb Conjugate another verb? [Yy] n $
Here are a list of requirements, assumptions and hints:
This program shall contain no global variables.
We assume that the maximum number of characters a verb (in its infinitive form or conjugated form) can contain is 30.
You will probably need to split the problem into a hierarchy of functions. A possible set of functions could include:A function that conjugates a verb.
For this function, it might be a good idea to have the pronouns and endings in arrays of strings.
A function that returns whether a verb ends in -er or not.
The main function should be the brain, reading the verb from the user and calling the conjugation function if the verb is valid, before asking if another verb should be inputted.
Since the user is only requested to enter a verb, you can safely use scanf() to read the verb (instead of using fgets() which would be more difficult to handle as it keeps the newline character as part of the input buffer).
List of some important libc functions that are used in the reference program: strlen(), strncpy(), strcat(), scanf().
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started