Text is : Four score and seven years ago our fathers brought forth on this conti
ID: 3605862 • Letter: T
Question
Text is:
Four score and seven years ago our fathers brought forth on this
continent a new nation, conceived in liberty, and dedicated to
the proposition that all men are created equal.
Now we are engaged in a great civil war, testing whether that
nation, or any nation so conceived and so dedicated, can long
endure. We are met on a great battlefield of that war. We have
come to dedicate a portion of that field, as a final resting
place for those who here gave their lives that that nation might
live. It is altogether fitting and proper that we should do this.
But, in a larger sense, we can not dedicate, we can not
consecrate, we can not hallow this ground. The brave men, living
and dead, who struggled here, have consecrated it, far above our
poor power to add or detract. The world will little note, nor long
remember what we say here, but it can never forget what they did
here. It is for us the living, rather, to be dedicated here to the
unfinished work which they who fought here have thus far so nobly
advanced. It is rather for us to be here dedicated to the great
task remaining before us-that from these honored dead we take
increased devotion to that cause for which they gave the last full
measure of devotion-that we here highly resolve that these dead
shall not have died in vain-that this nation, under God, shall have
a new birth of freedom-and that government of the people, by the
people, for the people, shall not perish from the earth.
Explanation / Answer
Here is code written in C documented with comments. Here file is taken as Poem,txt in sample run.
hello hhhl
ljlj kjlk
kjl;k ljkl;
this is word counting in thefilw thanks for your supoiert
helo
yeah
hello this is sample text for you
this line also have hello
so what are you
noe the wait is over hello dear
aa
// start of code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main ()
{
char filename[30], buffer[255], search[25];
int line=0; // for counting the lines in file
FILE* fp; // for opening file
printf("Enter File name: ");
scanf("%s",filename);// inputing file
if((fp = fopen(filename, "r")) == NULL) { // in case file was not able to open
printf("Error opening ");
return(-1);
}
printf("Enter the searching string: ");
scanf("%s",search);
printf("Word enetered for search is: %s ", search );
while(fgets(buffer, 255, (FILE*) fp)) // opening file till end
{
line++; // counting lines
char *pch = strstr(buffer, search); // checking substring using function
if (pch) // if search sucessfull
printf("Found %s on line %d : %s ",search,line,buffer ); // to print the seached word
}
return 0;
}
//end of code
Output of the code
user@pc:~$ gcc search_word.c -o search_word
user@pc:~$ ./search_word
Enter File name: Poem.txt
Enter the searching string: hello
Word enetered for search is: hello
Found hello on line 1 : hello hhhl
Found hello on line 7 : hello this is sample text for you
Found hello on line 8 : this line also have hello
Found hello on line 10 : noe the wait is over hello dear
user@pc:~$
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.