a program to search words in c++

Answers

Answer 1

Answer:

a starting point might be after you get this working, you can allow them to enter more words and iterate your search,

for each argument (not counting the first one that is the file name)

search for the word, show the lines...

and more files too, for that matter, for each file, for all the words... (at this point you MUST put flags on what each thing is, up to now, you can use the order of args)

just note that arg[] are c-strings. you can assign a string a c-string, so promotion lets you do things more normally, or you can process it as-is depending on what you use it for (see how I just used it in the file name but moved it to a string in the target?). I plan to use target a lot, but the file name only in one statement ever, no need to upcast it.

Explanation:

int main(int argc, char* argv[])

{

   if(argc < 3) //if the user did not provide enough command line inputs.  

    //you can, and should probably, do more exhaustive input validation and maybe have them

    //do flags as well rather than rely on the order of the arguments to be correct.

     {

        cout << "usage:  mygrep filename word"

        return 1;

     }

   ifstream infile(argv[1]);  //attempt to open the first target as the file

   string target = argv[2];   //assign target from the second argument

   

   ...


Related Questions

Use the class below to determine IF there is an error or if some part of the code is missing.

public class acceptInput {
public static void main (String[ ] args) {

Scanner scan = new Scanner (System.in);
System.out.println("How old are you? ");
int age = scan.nextInt();
System.out.println("Wow you are " + age + " years old. ");

}
}

- Scanner object has been declared incorrectly
- .nextInteger() should be used to accept an integer from the user.
- Age variable is not correctly printed in the sentence
- import java.util.Scanner; is missing
- Program runs as expected

Answers

Based on the given class below:

public class acceptInput {

public static void main (String[ ] args) {

Scanner scan = new Scanner (System.in);

System.out.println("How old are you? ");

int age = scan.nextInt();

System.out.println("Wow you are " + age + " years old. ");

}

}

The error that can be seen here is that the Scanner object has not been created

What is Debugging?

This refers to the term that is used to describe finding errors in a given program or system that prevents a code from properly executing and involves certain steps and processes.

Hence, it can be seen that the error in the code above is that there is the use of the Scanner object, but it is yet to be created which would return errors when the program is being run.

Read more about debugging here:

https://brainly.com/question/15079851

#SPJ1

Beth wants to start multimedia business in 3D modeling and sound integration and editing. She should invest in____ for 3D modeling and____ for sound editing.

Answers

Beth wants to start a multimedia business in 3D modeling and sound integration and editing. She should invest in Adobe Substance 3D Modeler for 3D modeling and Adobe Audition for sound editing.

What is 3D modeling?

3D modeling is a method in 3D computer graphics that involves manipulating edges, vertices, and polygons in a simulated 3D environment to create a mathematical coordinate-based depiction of any surface of an object in three dimensions using specialist software.

3D modeling may be applied almost anywhere. We know it's popular in film, video games, and animation, but that's not all. From architecture to mechanical engineering to the medical business, all of these demanding industries are finally realizing and capitalizing on the full potential of 3D modeling. 3D modeling may be beneficial in a variety of ways.

3D modeling may be classified into the following categories:

Solid modeling is used to create three-dimensional forms. The forms may differ, yet they function as building blocks when combined. Depending on the input, some of these blocks add material while others delete.

When the surface is complicated and curved, wireframe modeling might be useful. You'll eventually discover that the fundamental building blocks of solid modeling are too obtuse for some applications, while wireframe modeling gives the refinement for more complicated designs.

The next level of complexity is surface modeling. Smooth surfaces and flawless integration are required for highly professional applications, which may be handled by more complicated programs that need more labor and computational capacity.

Learn more about 3D modeling:
https://brainly.com/question/820276
#SPJ1

Answer:

An animation tool

a sound editing tool

Explanation:

Just took the quiz and got it right.

what is an output in computer science??​

Answers

Answer: Any information processed by and sent out from a computer or other electronic device is considered output.

Explanation:

Determine if the statement is true or false. Asymmetrical design can be visually balanced from left to right.
True or false

Answers

Answer:

true false asan pala tanong dyan?

It is false that the asymmetrical design can be visually balanced from left to right.

What is asymmetrical design?

Asymmetrical balance is the technique of achieving a sense of balance by using different visual elements of unequal weight on both sides of a composition.

If you understand that symmetrical means that both sides of something are identical, it should be simple to understand that asymmetrical means that the two sides are different in some way.

Asymmetrical objects are irregular and crooked, and do not perfectly match up when folded in half.

Asymmetry is the lack of symmetry or equality between your design's halves. While both halves of a symmetrical design are the same (or similar), both halves of an asymmetrical design are distinct.

Thus, the given statement is false.

For more details regarding asymmetrical design, visit:

https://brainly.com/question/14701136

#SPJ5

The term management information systems refers to a specific category of
information system serving. Discuss

Answers

Information systems specifically designed to support management-level tasks are referred to as management information systems (MIS).

What is meant by a management information system?

Management information systems is the study of people, organizations, technology, and their relationships (MIS). The return on investments in people, equipment, and company operations are maximized by businesses with the help of MIS specialists. MIS is a people-oriented field with a focus on providing technology-enabled services.

How crucial is a management information system?

A management information system boosts an organization's competitiveness. What is working and which isn't is reported and identified. Owners can use these reports to get the data they require to make decisions and raise employee and company performance.

Briefing:

Information systems specifically designed to support management-level tasks are referred to as management information systems (MIS). In most cases, MIS generates summary reports from enormous amounts of input data. MIS are virtually entirely focused on internal events rather than environmental or outside ones.

To know more about Management information systems (MIS) visit:

https://brainly.com/question/16131934

#SPJ10

which common design feature among instant messaging clients make them less secure than other means of communicating over the internet?

Answers

Peer-to-peer networking is the common design feature among instant messaging clients make them less secure than other means of communicating over the internet.

A straightforward computer network is a peer-to-peer network. It was created for the first time in the late 1970s. Within this network, each computer serves as a node for file sharing. There is no central server in the network because each node acts as a server in this case. This makes a tremendous amount of data sharing possible.

Each node receives an equal share of the tasks. Each linked node in the network has an equal share of work to do. Each node must stop functioning for the network to cease to exist. This is so that each node may function independently.

These networks often have less than 12 nodes, which is not a very large number. Although each machine in the network stores its own data, the entire group has access to it.

Peer-to-peer networks, in contrast to client-server networks, both use and provide resources. If the quantity of nodes rises, more resources are needed. Software specifically for this is needed. It enables network-wide resource sharing.

The nodes serve as both clients and servers, therefore an assault is always a possibility. Peer-to-peer networks are supported by almost all OS today.

To know more about peer-to-peer click on the link:

https://brainly.com/question/10571780

#SPJ4

1. Manny would like to design a flier for his new restaurant advertising their new
weekly specials. Which of the following programs should he use to complete this
task?
A. Microsoft Word
B. Microsoft
Publisher
C. Microsoft PowerPoint
D. Microsoft Excel

Answers

Since Manny would like to design a flier for his new restaurant advertising their new weekly specials, the software program which he should use to complete this task is: B. Microsoft Publisher.

The Microsoft Office package.

Generally speaking, the Microsoft Office comprises different software applications and these include the following:

Microsoft PublisherMicrosoft Word.Microsoft PowerPoint.Microsoft Excel.Microsoft AccessMicrosoft Project

What is Microsoft Publisher?

Microsoft Publisher can be defined as a desktop publishing software application or program that is designed and developed by Microsoft Inc.,  in order to avail its end users an ability or opportunity to work on page layout and graphic design such as a flier.

Read more on Microsoft Publisher here: https://brainly.com/question/26717262

#SPJ1

Answer:

D. Microsoft Excel

Explanation:

three transformations are available when you right-click a column header in the Query Editor window?

Answers

The three transformations are available when you right-click a column header in the Query Editor window are:

RemoveChange TypeDuplicate ColumnWhat is a query editor window?

You may edit and run queries using the Query Window, a fully featured editing environment. A few of the features the editor offers are listed below: editing with drag and drop. Automatic syntax highlighting and brace matching

What purposes does the query editor serve?

Power Query Editor is a component of Power BI Desktop as well. Connect to one or more data sources using Power Query Editor, then shape and manipulate the data to suit your needs before loading the model into Power BI Desktop.

How can you build a query editor?

The query you want to open should be double-clicked. Then, right-click the selected area and select Design Query in Editor from the menu that appears.

To know more about query editor window visit:

https://brainly.com/question/27960642

#SPJ10

I understand that the question you are looking for is:

Which 3 transformations are available when you right click a column header in the Query Editor window?

Some one please help me​

Answers

The Computer Networking Topology indicated above is called the Star Topology. While the Connecting Devices are:

Modem (Direct Connection to the Internet)Switch (Connects the internet to other devices via Lan and via the wireless router)

What is a Computer Network Topology?

The layout of the elements of a communication network is referred to as network topology. The term network topology refers to the layout of several forms of telecommunication networks, such as command and control radio networks, industrial field busses, and computer networks.

Physical things that can communicate with one another and other systems through the internet are referred to as connected devices. They range from classic computer gear like a laptop or desktop to typical mobile devices like a smartphone or tablet to an ever-expanding spectrum of physical devices and things.

A central hub or switch serves as a type of intermediary for data transfer in a star architecture. When seeking or supplying communication, each network device enlists the central hub.

Star topologies are simple to debug and scale since one broken node does not affect the others. For this architecture to function properly, the centralized device must constantly be in good working order.

Learn more about network topology:
https://brainly.com/question/13163014
#SPJ1

What is the value of grade after this program is executed? Assume the score is 71. if score >= 90: grade = "A" elif score >= 80: grade = "B" elif score >= 70: grade = "C" elif score >= 60: grade = "D" else: grade = "F" grade =

Answers

Answer:

C

Explanation:

if the score is 71 it would fall into 70 because it is not greater than 80 and not less than 70

Answer:

F= 50%

Fail is 50% grades.

I woke up this morning and turned on my computer to do some school work and my display was like shifted and some of the display was just black. You can even see on my task bar that it is going off the screen. I've tried changing my graphics and resolution and they we're the same, I've tried restarting my pc and refreshing my display still doesn't work. I've also done nothing for it to do this and I'm really confused. Please help me with this It's really stressing me out and I will do anything

Answers

Answer: This happened to me before, your computer has a virus and i had to get a new one , but you have two options, you have to open the pc and rearrange the blue and white wires or.... buy a new one

Explanation:

Answer:

You know what, it happened to me too. I had to reset it to the factory on my computer.

what actions must be taken in the event of a successful security intrusion?

Answers

Following are the steps that must be performed in the event of a successful security intrusion: planning, detection and analysis, containment, investigation, eradication, recovery, and after incident activities.

An intrusion into security is:

When an unauthorized person acquires access to a system or system resource, it is considered a security incident. This might happen as a result of a single security incident or a chain of connected security incidents.

What are intrusion attacks?

When someone tries to access any component of your computer system, it is called a computer intrusion. When attempting to breach a computer's security, computer attackers or hackers frequently employ automated computer programs.

What is incursion, and how is it recognized?

An intrusion detection system (IDS) is a hardware or software program that keeps an eye on a network for hostile activity or rules breaking. A security information and event management system is often used to report or gather data about any illegal activity or infraction.

To know more about security intrusion visit:

https://brainly.com/question/13844621

#SPJ10

Hello Can someone help me with this problem?
Bob and Alice want to send each other secret messages that no one else will have access to. They have decided that they will use a locked box to hold the secret messages, and they will drop the box off in each other’s mailboxes. The problem is that if they use a combination lock, they will have to send the combination to the box and someone might intercept it. Here are the materials they have access to:
A box that can be locked with a combination lock
Two combination locks (the kinds that click shut that you might use on a school locker)
Paper
Pencil
Describe a protocol Bob and Alice can set up to deliver these messages securely.

Answers

Explanation:

Bob and Alice could first send each other their open locks. Then, e.g., Alice can send a message to Bob and lock her box with Bob's lock, and vice-versa.

A more real-world approach to this problem is that they use a form of Diffie-Hellman approach to exchange a combination for the lock.

Diffie-Hellman is an algorithm where you can exchange secrets even if you know someone is intercepting each and every message you exchange. It's a bit mathematical, but still very cool.

Absolute or mixed cell referencing does not apply to the array arguments when copying a VLOOKUP or HLOOKUP function to another cell. Absolute or mixed cell referencing does not apply to the array arguments when copying a VLOOKUP or HLOOKUP function to another cell. True False

Answers

The statement "absolute or mixed cell referencing does not apply to the array arguments when copying a VLOOKUP or HLOOKUP function to another cell" is absolutely false.

What is a table array in HLOOKUP?

When a user constructs a VLOOKUP or HLOOKUP function, he/she must definitely require to enter a range of cells. This range of cells is referred to as the table array in HLOOKUP.

This table array argument in VLOOKUP or HLOOKUP function determined the fragment of data that a function needs in order to run without any deformity.

Therefore, the statement "absolute or mixed cell referencing does not apply to the array arguments when copying a VLOOKUP or HLOOKUP function to another cell" is absolutely false.

To learn more about HLOOKUP functions, refer to the link:

https://brainly.com/question/22603459

#SPJ1

EasyMart (EM) has a physical store and an online shopping site and is coming up with deals on retail products for the week of Christmas. As a marketing consultant at EM, which of the following tactics would you recommend achieving the highest sales?

a.
Issue discount cards redeemable on future purchases

b.
Issue digital coupons for discounts on all products

c.
Issue discount coupons in newspapers for all products

d.
Issue in-store coupons for select products and brands

Answers

Answer:

a

Explanation:

because the discount card will be redeemable in future when she both the products

If String str = "United States";, then what is the value of str.substring(2, 4);? (2 points)

ni
nit
it
ite
nite

Answers

Explanation:

Program PascalABC:

Rezult  ited

Who is Heavy Weapons Guy?

Answers

Answer:

The Heavy, whose real name is Mikhail (called Misha by his family), is a hulk hailing from the USSR, and possibly the most dangerous class in Team Fortress, armed with a powerful Minigun .

Answer:

Gary Schwartz

Kinoflos are a type of:


A. A lighting wheel that contains red, blue, and green scrims

B. A type of fluorescent soft light

C. Bright overhead incandescent spotlight

D. A type of fluorescent hard light

Answers

Answer:

d a type of ni is the way to go

what is telnet internet service

Answers

Answer:

A terminal protocol usually running on TCP port 23.

Explanation:

With a telnet client, you can connect to a system and execute shell commands, usually on (but not limited to) a unix type of system.

Since telnet is a simple text-based character-in character-out protocol, it is also possible to telnet to a web server or a mail server (services that are not on port 23), and issue the same commands as a browser or mail client would.

Answer:

Telnet is a network protocol used to virtually access a computer and to provide a two-way, collaborative and text-based communication channel between two machines

Define a function called helloWorld(n) that accepts a number of n as input argument and return n times text message "Hello World!". Call your functions.

Answers

#include <bits/stdc++.h>

void helloWorld(int n) {

   for(int i=0;i<n;i++) {

       std::cout << "Hello world!\n";

   }

}

int main(int argc, char* argv[]) {

   int x; std::cin>>x;

   helloWorld(x);

   return 0;

}

A function is a block of organized, reusable code that is used to perform a single, related action.

What is meant by function?

Simply said, a function is a "chunk" of code that you may reuse repeatedly rather than having to write it out several times. Programmers can divide an issue into smaller, more manageable parts, each of which can carry out a specific task, using functions.

A function is a segment of clean, reusable code that executes a single, connected operation. A higher level of code reuse and improved application modularity are provided via functions. Various functions like printf() and main have already been shown to you ().

The program is as follows:

#include <bits/stdc++.h>

void helloWorld(int n) {

 for(int i=0;i<n;i++) {

   std::cout << "Hello world!\n";

 }

}

int main(int argc, char* argv[]) {

 int x; std::cin>>x;

 helloWorld(x);

 return 0;

}

To learn more about functions refer to:

https://brainly.com/question/19181382

#SPJ2

how do you delete your account when you forgot your password?! lol

Answers

Answer: okay if you remember the email you used, even if you logged in through goooooooooogle, just put the email and say forget the password. They will ask if you'd like to send a verification code to your email to change your password. Click yes. Go to your email change the password then use it to log in once again to your account.

Explanation:

What is one lighting technique that is used to simulate a strong sun?

Answers

Answer:

Heat lamp.

Explanation:

Like the sun, a heat lamp gives off light and heat, mimicking the actions of a sun. To simulate a strong sun, turn the heat lamp up higher to create brighter light and warmer heat.

Hope this helps!

A paralegal bills a law firm for 19.5 hours of work at a rate of £240 per hour. How much money has the paralegal earned from this job? Include units in your answer.

Answers

The amount of money that this employee (paralegal) has earned from his job is equal to £4,680.

What is an expression?

An expression can be defined as a mathematical equation which is used to show the relationship existing between two or more variables and numerical quantities.

In this exercise, you're required to calculate the amount of money that this employee (paralegal) has earned from his job. Therefore, an expression which can be used to calculate the amount of money that this paralegal staff earned is given by:

Amount of money = Rate × Amount of hours worked

Substituting the given parameters into the formula, we have;

Amount of money = 240 × 19.5

Amount of money = £4,680.

Read more on expressions here: brainly.com/question/17361494

#SPJ1

Define a function called isEvenOdd(n) that accepts a number n as input argument and returns whether the number is even or odd. Call your functions

Answers

#include <bits/stdc++.h>

typedef std::string s;

s isEvenOdd(int n) {

   return (n%2==0) ? "Even" : "Odd";

}

int main(int argc, char* argv[]) {

   int x; std::cin>>x;

   std::cout << isEvenOdd(x) << std::endl;

   return 0;

}

Answer:

Explanation:

var n : integer;

 

 function IsEvenOdd (n : integer): boolean;

 begin

   if odd (n) then  Result := true

              else  Result := false;

 end;

 

 begin

   Write (' n = '); ReadLn (n);

   WriteLn ('  ', IsEvenOdd (n));

 end.  

 

 

1. Your employer is opening a new location, and the IT director has assigned you the task of calculating subnets for the new network. You’ve determined that you need 50 subnets for the class B network beginning with the network ID 172.20.0.0. how many unused subnets will be waiting on hold for future expansion? How many possible hosts can each subnet support?

Answers

14 subnets that are unused will be waiting on hold for future expansion.1022 possible hosts can each subnet support.

What is subnets?

A subnetwork, also known as a subnet, is a logical division of an IP network. Subnetting is the practise of dividing a network in to the two or more networks. Computers on the same subnet are addressed in their IP addresses with the same most-significant bit-group. As a result, an IP address is logically divided up into two fields: the network number or routing prefix and the rest field as well as host identifier. The rest field identifies a particular host or network interface.

After subnetting, we have 16+6 = 22 network and 16-6=10 host bits.

No. of unused subnets = 2^6-50 = 14 subnets

No. of hosts. per each subnet =2^10-2 = 1022 hosts.

To learn more about subnets

https://brainly.com/question/28256854

#SPJ9

if you delete a shortcut from your desktop, have you also deleted the original file?

Answers

I don’t think so. When you delete a shortcut, it’s deleting the way to get there faster and not the file itself. To delete the original file, you would have to go directly to it or delete. Also make sure to delete it permanently if you want, because after you delete it there tends to be an option where you could bring it back, unless the device actually tells your the file is going to be deleted permanently the first time.

Computers are used to input, store, process, find and share vast amounts of data and information, and they can do so in
fractions of a second. Discuss the concept of abstraction and abstract data types on computer programming

Answers

The concept of abstraction and abstract data types on computer programming is given below.

The use of abstraction to manage complexity is crucial. When anything is regarded abstractly, just the salient characteristics are highlighted. It is not necessary to recall or even notice the information that is left out.

What is abstraction?

An abstraction of a data structure that merely provides the interface to which the data structure must conform is referred to as an abstract data type. No precise information about how something should be implemented or in what programming language is provided by the interface.

An object's behavior can be described by a set of values and a set of actions, and this behavior is known as an abstract data type (ADT).  The definition of ADT merely specifies the actions that must be taken, not how they must be carried out.

Therefore, List data structures, stack data structures, and queue data structures are examples of abstract data types in data structures. The abstract data type defines a number of legitimate operations that can be performed on a specific data structure.

Learn more about abstraction  from

https://brainly.com/question/7994244
#SPJ1

what word is used today to refer to network-connected hardware devices?

Answers

The word used now to refer to it is endpoint.

The word that is used today to refer to network-connected hardware devices is an endpoint device.

What is an endpoint device?

Any device that is physically an endpoint on a network is referred to as an endpoint. Endpoints include desktop computers, laptops, mobile phones, tablets, servers, and virtual environments.

The desktop, laptop, or smartphone that the antivirus is installed on is the endpoint when one thinks of a traditional home antivirus.

On a TCP/IP network, an endpoint device is a piece of hardware with Internet access. In addition to printers and thin clients, the phrase can also be used to describe point-of-sale (POS) terminals, smart meters, smartphones, tablets, thin clients, and laptops.

Therefore, an endpoint device is a term used today to describe hardware components connected to a network.

To learn more about endpoint devices, refer to the link:

https://brainly.com/question/24768005

#SPJ12

Network access methods used in PC networks are defined by the IEEE 802
standards.
O a.
False
O b. True

Answers

Answer: stand

Explanation:

An incentive to accept a new job is _____.

high wages
expensive commute
long hours

Answers

high wages - it is the only advantage there.

Answer:high wages

Explanation:

Other Questions
An object starts at a point +25 m goes 40 m towards +X direction in 5 s then suddenly changes its direction to the opposite and covers 50 m in 10 seconds. What was its average speed during the first 5 s? please help cont figure it outOn a map, a road is 6 1/2 inches long. If the scale is 1/4 inch equals 1 mile, how many miles is the actual road? QUICKLY HELPPPP!Which excerpt from the story best supports the conclusion that the narrator is putting a lot of effort into her job search? A) Then a woman I worked with at my part-time job told me about a reporter position opening up . . . B) By the time I began the search for my first full-time job, the job market was in bad shape. C) All the job search materials Id read stressed the importance of networking in finding a job. D) Id taken up my boss on his offer and stayed at my part-time job through the summer after college. Please help. This is due soon I need help with this science question If regulation increases price and decreases supply, why does the government issue regulations? what is the part labeled 3? Jason likes to play video games. His parents allow him to play for 20 minutes plus 10 min for each half hour he does chores or studies. He can never play for more than 90 min/day. The function f(x) = 20 + 10x models the number of minutes per day Jason could play where x represents the number of half hour increments he has done chores or studied. What is the practical range of the function? what instrument does not perform in this recording of susato's three dances? Why does authors look at the people perceptive more than chris perspective into the wild ? Drag all of the necessary steps into the box to find the product of 2.36.5 using partial products. Some choices may not be used.1. 2.06.0=122. 2.05.0=10 3. 2.00.5=1 4. 0.30.6=0.18 5. 0.36=1.8 6. 0.35=1.5 7. 0.30.5=0.15 Please help and leave an explanation. I am struggling with radicals and exponents. in the osi model, which of the following functions are performed at the application layer? (select two.) O Points: 0 of 1A mural measures 135 feet long by 190 feet high. Find the ratio of the height to the perimeter of this mural.*** researchers manipulate or control variables in order to conduct: A plane flying horizontally at an altitude of 1 mi and a speed of 590 mi/h passes directly over a radar station. Find the rate at which the distance from the plane to the station is increasing when it has a total distance of 5 mi away from the station. (Round your answer to the nearest whole number.) Sarah said that 0.000 01 is bigger that 0.001 because the first number has more digits to the right of the decimals point is Sarah correct explain your thickin using negative powers of 10 and the number line Consider the reaction. 2Al(s)+Fe2O3(s)heatAl2O3(s)+2Fe(l) If 20.4 kg Al reacts with an excess of Fe2O3, how many kilograms of Al2O3 will be produced? Are these fractions equivalent or nonequivalent?9/193/4Click on the correct answer. brain's tent is a triangular prism how much fabric was used make the tent