c++ code: Write a program that will
search the file data.txt for the following words in the given order
Liberty
great
dedicated
nation
for
God
If all of the words are found in the correct order then print our FOUND, otherwise print out NOT FOUND
Rerun the program but search for the words in the order
Liberty
great
dedicated
nation
God
for
THE PROGRAM IS CODED ON GCC COMPILER i.e.
g++ file.c
./a.out
CODE:
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<fstream.h>
#include<cstring.h>
int main()
{
fstream file;
int a[5];
int i=0;
string word, t, q, filename;
filename = "file.txt";
file.open(filename.c_str());
while (file >> word)
{
if
(word=="Liberty")
{
i=10;
}
if (i==10 &&
word=="great")
{i=20;}
if (i==20 &&
word=="dedicated")
{i=30;}
if (i==30 &&
word=="nation")
{i=40;}
if (i==40 &&
word=="for")
{i=50;}
if (i==50 &&
word=="God")
{i=60;}
}
if (i==60)
{cout<<"the words are in order";}
else{cout<<"the words are not in order";}
return 0;
}
c++ code: Write a program that will search the file data.txt for the following words in...
and save it in the same folder as your source Download file: data.txt code file. data.txt contains a list of client's account number, client's name and their balance. Write a C program to read rows of data from the file and store them in the arrays. Display the list of client's account number, client's name and the client's balance on the screen in reverse order. The program should write the data in reverse order (without header) to another file called...
Write a complete C program to get data from file name DATA.TXT one line at a time until there is no more data in that file. The following is one sample line in DATA.TXT ( have as many record as you wish in DATA.TXT) Name SSN quiz mid assignments participation final LISA 111-11-1111 100 100 100 100 100 Jack 222-22-2222 80 80 100 90 100 Note that the first line is no in DATA.txt. Your program should create...
USING PYTHON PROGRAMMING
LANGUAGE
15. Write code to open a file named data.txt, which contains 3 numbers, and print the sum of those numbers to the console 16. Write code that opens a file named words.txt containing an essay, and the prints out the SECOND word in the file to the console
You're to write a C++ program that analyzes the contents of an external file called data.txt. (You can create this file yourself using nano, that produces a simple ASCII text file.) The program you write will open data.txt, look at its contents and determine the number of uppercase, lowercase, digit, punctuation and whitespace characters contained in the file so that the caller can report the results to stdout. Additionally, the function will return the total number of characters read to...
Write a program **(IN C)** that displays all the phone numbers in a file that match the area code that the user is searching for. The program prompts the user to enter the phone number and the name of a file. The program writes the matching phone numbers to the output file. For example, Enter the file name: phone_numbers.txt Enter the area code: 813 Output: encoded words are written to file: 813_phone_numbers.txt The program reads the content of the file...
Write a program to read the contents of data.txt file, and determine the smallest value (min), largest value (max), and the average value (ave). The minimum, maximum, and average values must be calculated in the function calc(). Remember to declare the stdlib.h library, so that you can use the atof function, which will convert the number in the text file into float number. Also, remember to check if there is an error opening the file or not. If there is...
Python 3:Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order. Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order An example file along with the correct output is shown below: example.txt the quick brown fox jumps over the lazy dog Enter the input file name: example.txt brown dog fox jumps lazy over quick the
Using C programming Compose a program that will read in the provided data file and remove all of the comma characters and replace them with an empty white space character. Your program should output the now cleaned data to a new file with the name n01427232_parsed.txt Provided Data file I,Pledge,Allegiance,to,the,flag of,the,United,States,of,America and,to,the,Republic for,which,it,stands, one,Nation,under,God, indivisible, with,liberty,and,justice,for,all. .
Write a program that reads a series of words (one word per line) from a file named data.txt. Each word in the file should have each of its characters shifted by 1 character value in the ASCII table (incremented) and then that new word with its characters shifted should be printed to a new file named result.txt. Each word from data.txt should be reprinted with its new encoding in result.txt. Your program should not have any knowledge of how many...
C++ not C please Lyric Search Write a program that asks the user for a file name and a string to search for. The program should search the file for every occurrance of the string. When the string is found it should display the line that it iwas found on and report the total number of occurrances of the string at the end. Place a text file with your favorite song lyrics in it and use to to perform a...