Question

THIS MUST BE SOMETHING NEW AND DIFFERENT from NORMAL ANSWERS You must write a complete code...

THIS MUST BE SOMETHING NEW AND DIFFERENT from NORMAL ANSWERS

You must write a complete code in C PROGRAMMING Language using FILE Handling

  1. Use ABSOLUTE PATH SPECIFICATION
  2. Read a passage or text from a file named “research.txt”
  3. Remove all the present a,e,i,o,u basically all vowels from any word i.e. word must look like wrd after it removes the o from it, in the given text
  4. Save data in the new file named “proposal.txt”

THINGS TO CONSIDER

  • YOU MAY USE FUNCTIONS OR DO IT WITHOUT FUNCTIONS
  • USE POINTERS IF NEEDED
  • MAKE IT AS SIMPLE AS POSSIBLE
  • USE COMMENTS TO HIGHLIGHT EACH main command.

DATA

research.txt has the following data

The newly-civilized Enkidu leaves the wilderness with his consort for the city of Uruk, where he learns to help the local shepherds and trappers in their work.

One day, when Gilgamesh himself comes to a wedding party to sleep with the bride, as is his custom, he finds his way blocked by the mighty Enkidu, who opposes Gilgamesh‘s ego, his treatment of women and the defamation of the sacred bonds of marriage.

Enkidu and Gilgamesh fight each other and, after a mighty battle, Gilgamesh defeats Enkidu, but breaks off from the fight and spares his life.

He also begins to heed what Enkidu has said, and to learn the virtues of mercy and humility, along with courage and nobility.

Both Gilgamesh and Enkidu are transformed for the better through their new-found friendship and have many lessons to learn from each other. In time, they begin to see each other as brothers and become inseparable.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Given below is the code for the question. Please do rate the answer if it helped. Thank you.


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void processFile(char inFilename[], char outFilename[]);
int isVowel(char c);
void removeVowels(char words[]);

int main(){
   char inFilename[100] = "research.txt";
   char outFilename[100] = "proposal.txt";
  
   processFile(inFilename, outFilename);
   return 0;
}

void processFile(char inFilename[], char outFilename[]){
   char line[1024];
   char word[25];
   FILE *in = fopen(inFilename, "r");
   FILE *out = fopen(outFilename, "w");
  
   if(in == NULL){
       printf("ERROR: could not read input file %s\n", inFilename);
       return;
   }
  
   fgets(line, 1024, in);
   while(!feof(in)){
       removeVowels(line);
       fprintf(out, "%s", line);
       fgets(line, 1024, in);
   }
  
   fclose(in);
   fclose(out);
   printf("Output file %s created\n", outFilename);
}

  
int isVowel(char c){
   if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'
       || c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U')
       return 1;
   else
       return 0;
}

void removeVowels(char str[]){
   char *dest, *src;
   src = str;
   dest = str;
  
   //go over each char and remove it if it is vowel. Keep a track of src i.e. char being processed and dest i.e the position where the char will be written if its not vowel.
   //the original string is modified.
   while(*src){
       if(!isVowel(*src)){
           *dest = *src;
           dest++;
       }
       src++;
   }
  
   *dest = '\0'; //terminate the string
      
}

-----------------------
proposal.txt (created by program)
--------------
Th nwly-cvlzd nkd lvs th wldrnss wth hs cnsrt fr th cty f rk, whr h lrns t hlp th lcl shphrds nd trpprs n thr wrk.

n dy, whn Glgmsh hmslf cms t wddng prty t slp wth th brd, s s hs cstm, h fnds hs wy blckd by th mghty nkd, wh ppss Glgmsh‘s g, hs trtmnt f wmn nd th dfmtn f th scrd bnds f mrrg.

nkd nd Glgmsh fght ch thr nd, ftr mghty bttl, Glgmsh dfts nkd, bt brks ff frm th fght nd sprs hs lf.

H ls bgns t hd wht nkd hs sd, nd t lrn th vrts f mrcy nd hmlty, lng wth crg nd nblty.

Add a comment
Know the answer?
Add Answer to:
THIS MUST BE SOMETHING NEW AND DIFFERENT from NORMAL ANSWERS You must write a complete code...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Overview: file you have to complete is WordTree.h, WordTree.cpp, main.cpp Write a program in C++ that...

    Overview: file you have to complete is WordTree.h, WordTree.cpp, main.cpp Write a program in C++ that reads an input text file and counts the occurrence of individual words in the file. You will see a binary tree to keep track of words and their counts. Project description: The program should open and read an input file (named input.txt) in turn, and build a binary search tree of the words and their counts. The words will be stored in alphabetical order...

  • OP You are an insurance agent who must write a policy for a new client named...

    OP You are an insurance agent who must write a policy for a new client named Sam. His company, Society for Creative Alternatives to Mayonnaise (SCAM), is working on a low-fat, low-cholesterol mayonnaise substitute for the sandwich-condiment industry. The sandwich industry will pay top dollar to the first inventor to patent such a mayonnaise substitute. Sam's SCAM seems like a very risky proposition to you. You have calculated his possible returns table as follows: Probability Return Outcome 0.999 $ -...

  • Can anyone help me with my C hw? Exercise 3 You will write a new program...

    Can anyone help me with my C hw? Exercise 3 You will write a new program that combines dynamically allocating an array and saving that array to a file. These are the tasks your program must perform Open an output file named "data.txt" and prepare it for writing in text mode o If the file handle is NULL, quit the program o By default, it is created and stored in the same directory as your source code file Prompt the...

  • Implement the histogram function to complete the desired program. You must use dynamically allocated arrays for...

    Implement the histogram function to complete the desired program. You must use dynamically allocated arrays for this purpose. For your initial implementation, use ordered insertion to keep the words in order and ordered sequential search when looking for words. Note that the array utility functions from the lecture notes are available to you as art of the provided code. Although we are counting words in this program, the general pattern of counting occurrences of things is a common analysis step...

  • For this lab you will write a Java program that plays a simple Guess The Word...

    For this lab you will write a Java program that plays a simple Guess The Word game. The program will prompt the user to enter the name of a file containing a list of words. These words mustbe stored in an ArrayList, and the program will not know how many words are in the file before it starts putting them in the list. When all of the words have been read from the file, the program randomly chooses one word...

  • You are the systems manager for Blue City Movies Rentals and you have been asked to create a report on historical sales data. To complete your task you will combine and edit data from multiple sources using Excel’s Power add-ins, XML, and tex

    You are the systems manager for Blue City Movies Rentals and you have been asked to create a report on historical sales data. To complete your task you will combine and edit data from multiple sources using Excel’s Power add-ins, XML, and text functions.Instructions:For the purpose of grading the project you are required to perform the following tasks:StepInstructionsPoints Possible1Open e10c2MovieRentals.xlsx and save the workbook with the name e10c2MovieRentals_LastFirst.02Import the movie data from the delimited file e10c2Movies.txt and rename the new worksheet Inventory.Hint: On the Data tab,...

  • write a code on .C file Problem Write a C program to implement a banking application...

    write a code on .C file Problem Write a C program to implement a banking application system. The program design must use a main and the below functions only. The program should use the below three text files that contain a set of lines. Sample data of these files are provided with the assessment. Note that you cannot use the library string.h to manipulate string variables. For the file operations and manipulations, you can use only the following functions: fopen(),...

  • i have the case study question with the answers but i need help to re-write the...

    i have the case study question with the answers but i need help to re-write the answers. please see the attached files Case Study Analysis (CSF3003) Assessment Description and Requirements CLO1: Case Study 1 Ahmad lef home to study master and PhD in Australia. He has fees for the first semester only. After he arrived to Sydney and settled down, he start looking for a part-time job to save money for the next term. Ahmad has some experience on making...

  • Python program This assignment requires you to write a single large program. I have broken it...

    Python program This assignment requires you to write a single large program. I have broken it into two parts below as a suggestion for how to approach writing the code. Please turn in one program file. Sentiment Analysis is a Big Data problem which seeks to determine the general attitude of a writer given some text they have written. For instance, we would like to have a program that could look at the text "The film was a breath of...

  • This project is meant to give you experience writing linked lists and graphs. As such, you...

    This project is meant to give you experience writing linked lists and graphs. As such, you are not permitted to use arrays or any data structure library. You may, however, make use of code presented in class and posted to Blackboard. Objective Your goal for this project is to take a block of text, analyze it, and produce random sentences in the style of the original text. For example, your program, given Wizard of Oz, might produce: how quite lion...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT