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...

  • FIRST: Write code that prompts the user for the name of a text file, opens that...

    FIRST: Write code that prompts the user for the name of a text file, opens that file if it exists and reads the file one line at a time printing each line to the screen. You must implement the file read in a try/catch block rather than throwing the exception on the main method. NEXT: Modify your code so that the program takes the name of two files from the command line, opens the first file if it exists for...

  • 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 $ -...

  • In this lab you will write a spell check program. The program has two input files:...

    In this lab you will write a spell check program. The program has two input files: one is the dictionary (a list of valid words) and the other is the document to be spellchecked. The program will read in the words for the dictionary, then will read the document and check whether each word is found in the dictionary. If not, the user will be prompted to leave the word as is or type in a replacement word and add...

  • 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...

  • //I NEED THE PROGRAM IN C LANGUAGE!// QUESTION: I need you to write a program which...

    //I NEED THE PROGRAM IN C LANGUAGE!// QUESTION: I need you to write a program which manipulates text from an input file using the string library. Your program will accept command line arguments for the input and output file names as well as a list of blacklisted words. There are two major features in this programming: 1. Given an input file with text and a list of words, find and replace every use of these blacklisted words with the string...

  • 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 program, you will be working with data from the NASA website which lists Near...

    For this program, you will be working with data from the NASA website which lists Near Earth Objects detected by the JPL Sentry System. You are given a text file listing the designation and impact probability (with Earth, generally within the next 100 years) of 585 Near Earth Objects. Your job will be to sort these objects by their impact probabilities. Input File Format The input file contains 585 records. Each record is on a separate line. Each line contains...

  • 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,...

  • C programming. please include comments In this lab, you will learn to read data from and...

    C programming. please include comments In this lab, you will learn to read data from and write data to a file - another use for pointers. SAMPLE PROGRAM There are two sample programs this week - WriteFile.c and ReadFile.c. The first, WriteFile.c, allows the user to enter customer names (first, middle, and last), and writes each name to an output text file, customerNames.txt. formatted as: firstName middlelnitial lastName" After you've run it once, what happens to the names you added...

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