Write a c++ code to read 4 documents and with the use of Boolean operators, search which of the document contains
1) NOT (cars OR trucks) and 2) (NOT cars) AND (NOT trucks)
The documents are as following -
Document 1(file1.txt): search for the word “cars”.
|
some people think cars they own is extension of their personality somehow the idea that cars define people is very materialistic for some for some people cars are just a way of transportation from point a to b I like cars some people like to collect old cars as a hobby I guess one needs to be rich to have such a hobby for some people cars are bad because gasoline pollutes environment do you like cars |
Document 2(file2.txt):search for the word “trucks”.
|
some people think trucks they own is extension of their personality somehow the idea that trucks define people is very materialistic for some for some people trucks are just a way of transportation from point a to b I like trucks some people like to collect old trucks as a hobby I guess one needs to be rich to have such a hobby for some people trucks are bad because gasoline pollutes environment do you like trucks |
Document 3(file3.txt): search for the word “cars” and trucks.
|
some people think cars they own is extension of their personality somehow the idea that cars define people is very materialistic for some for some people cars are just a way of transportation from point a to b I like cars some people like to collect old cars as a hobby I guess one needs to be rich to have such a hobby for some people cars are bad because gasoline pollutes environment do you like cars some people think trucks they own is extension of their personality somehow the idea that trucks define people is very materialistic for some for some people trucks are just a way of transportation from point a to b I like trucks some people like to collect old trucks as a hobby I guess one needs to be rich to have such a hobby for some people trucks are bad because gasoline pollutes environment do you like trucks |
Document 4(file4.txt): Contains neither “cars” nor “trucks”.
|
after every calamity there is ease we ask for ourselves mercy but others we ask for justice what you seek is seeking you yesterday I was clever so I wanted to change the world today I am wise so I am changing myself raise your words not voice it is rain that grows flowers not thunder find yourself for everything else there is google |
Thank you
I am writing 4 separate codes for 4 documents and the corresponding outputs.
Code
#include<bits/stdc++.h>
using namespace std;
int main(){
ifstream iff("file1.txt");
//searching for the word "cars"
string line;
bool car = 0;
while(getline(iff, line)){
istringstream iss(line);
string word;
while(iss >> word){
if(word ==
"cars"){
car = 1;
}
}
}
if(car == 1)
cout << "'cars' is present in
the document";
else
cout << "'cars' is not
present in the document";
}
Output

Code
#include<bits/stdc++.h>
using namespace std;
int main(){
ifstream iff("file2.txt");
//searching for the word "trucks"
string line;
bool truck = 0;
while(getline(iff, line)){
istringstream iss(line);
string word;
while(iss >> word){
if(word ==
"trucks"){
truck = 1;
}
}
}
if(truck == 1)
cout << "'trucks' is present
in the document";
else
cout << "'cars' is not
present in the document";
}
Output
Code
#include<bits/stdc++.h>
using namespace std;
int main(){
ifstream iff("file3.txt");
//searching for the word "cars" and "trucks"
string line;
bool truck = 0,car = 0;
while(getline(iff, line)){
istringstream iss(line);
string word;
while(iss >> word){
if(word ==
"trucks"){
truck = 1;
}
if(word ==
"cars"){
car = 1;
}
}
}
if(truck == 1 && car == 1)
cout << "'trucks' and 'cars'
is present in the document";
else
cout << "'trucks' and 'cars'
is not present in the document";
}
Output
Code
#include<bits/stdc++.h>
using namespace std;
int main(){
ifstream iff("file4.txt");
//searching for the word "cars" and "trucks"
string line;
bool truck = 0,car = 0;
while(getline(iff, line)){
istringstream iss(line);
string word;
while(iss >> word){
if(word ==
"trucks"){
truck = 1;
}
if(word ==
"cars"){
car = 1;
}
}
}
if(truck == 0 && car == 0)
cout << " neither 'trucks'
nor 'cars' is present in the document";
else
cout << "Some of them are
present";
}
Output

Write a c++ code to read 4 documents and with the use of Boolean operators, search which...
some people think cars they own is extension of their personality somehow the idea that cars define people is very materialistic for some for some people cars are just a way of transportation from point a to b I like cars some people like to collect old cars as a hobby I guess one needs to be rich to have such a hobby for some people cars are bad because gasoline pollutes environment do you like cars Read this document...
some people think cars they own is extension of their personality somehow the idea that cars define people is very materialistic for some for some people cars are just a way of transportation from point a to b I like cars some people like to collect old cars as a hobby I guess one needs to be rich to have such a hobby for some people cars are bad because gasoline pollutes environment do you like cars Read this document...
C Programming - Please Help us! Implementing Load Balancing, the 3 Base Code files are at the bottom: Implementing Load Balancing Summary: In this homework, you will be implementing the main muti-threaded logic for doing batch based server load balancing using mutexes Background In this assignment you will write a batch-based load balancer. Consider a server which handles data proces- sing based on user requests. In general, a server has only a fixed set of hardware resources that it can...
Can someone please read this case for me and answer this question and thank you. 1. Utilize the triple bottom line to measure Uber’s performance under Kalanick’s leadership. Make sure to incorporate examples from the case in your response. Uber - A Startup’s Origins and Early Days Case: Criticizing customers. Short-changing workers. Sassing regulators. Deceiving authorities. Emphasizing rule breaking and ruthlessness in a “win at all costs” workplace culture. Is this what it takes to go from startup to a...
urgent need asap 2-4 sentences summarizing the article 4 quotes and in each quote i need 4 bullet points explaning the uote The Nature of Creativity Robert J. Sternberg The field of creativity as it exists today emerged largely as a result of the pioneering efforts of J. P. Guilford (1950) and E. Paul Torrance (1962, 1974). It is wholly fitting to dedicate a special issue of the Creativity Re- search Journal to Torrance because of his seminal con- tributions...
second attempt. need asap please 2-4 sentences summarizing the article 4 interesting quotes from the article and 4 points explaning for each quote The Nature of Creativity Robert J. Sternberg The field of creativity as it exists today emerged largely as a result of the pioneering efforts of J. P. Guilford (1950) and E. Paul Torrance (1962, 1974). It is wholly fitting to dedicate a special issue of the Creativity Re- search Journal to Torrance because of his seminal con-...
Please, i need Unique answer, Use your own words (don't copy and paste). Please, don't use handwriting, Use your keyboard. I need you to redrafting my answer, please.. Q1. How does UPS's approach toward sustainability impact the triple bottom line? Be specific. As a founding member of UPS’s sustainability steering committee have wrestled with the challenge and developed a point of view, one that emphasizes the power of organizational momentum and embraces “enlightened self-interested the companies have a responsibility to contribute...
Case: Criticizing customers. Short-changing workers. Sassing regulators. Deceiving authorities. Emphasizing rule breaking and ruthlessness in a “win at all costs” workplace culture. Is this what it takes to go from startup to a $70 billion business in only seven years? Or are these characterizations false, the criticisms of jealous rivals? Let’s take an extended look at the exciting journey of the low-cost ridehailing service known as Uber, or Uber Technologies Inc., one of the leading transportation services of the world....
Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...
Read about Cokes strategy in Africa in the article below and discuss the ethics of selling soft drinks to very poor people. Is this an issue that a company like Coke should consider? Africa: Coke's Last Frontier Sales are flat in developed countries. For Coke to keep growing, Africa is it By Duane Stanford Piles of trash are burning outside the Mamakamau Shop in Uthiru, a suburb of Nairobi, Kenya. Sewage trickles by in an open trench. Across the street,...