#define _CRT_SECURE_NO_WARNINGS //for windows os only
#include <stdio.h>
#include <string.h>
#define SIZE 16
char *words[SIZE] = { “AMAZING”, “ACHIEVEMENT”, “LEARNING”,”ACCOMPLISHMENT”,
“LIVING”, “ACHIEVING”, “CREATING”,”COLLABORATING”, “LIFE”,”MOTIVATED”, “DRIVEN”,”STUDY”,
“FORMATTED”, “LEARNED”, “CODING”, “SHOPPING”};
int endsInED(char *toCheck);//function prototype
int main(void)
{
}
This is an extension to the above programe
char *words[SIZE] = { “AMAZING”, “ACHIEVEMENT”, “LEARNING”,”ACCOMPLISHMENT”,
“LIVING”, “ACHIEVING”, “CREATING”,”COLLABORATING”, “LIFE”,”MOTIVATED”, “DRIVEN”,
“STUDY”, “FORMATTED”, “LEARNED”, “CODING”, “SHOPPING”};
The task is to extract only the words that end in ‘ING’ and aregreater than six characters. Print those words to the screen.
Answer
#define _CRT_SECURE_NO_WARNINGS //for windows os only
#include <stdio.h>
#include <string.h>
#define SIZE 16
char *words[SIZE] = { “AMAZING”, “ACHIEVEMENT”, “LEARNING”,”ACCOMPLISHMENT”,
“LIVING”, “ACHIEVING”, “CREATING”,”COLLABORATING”, “LIFE”,”MOTIVATED”, “DRIVEN”,”STUDY”,
“FORMATTED”, “LEARNED”, “CODING”, “SHOPPING”};
int endsInED(char *toCheck);//function prototype
int main(void)
{
for(int i=0;i<SIZE;i++)
if(strlen(words[i])>6 &&