1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Darina [25.2K]
3 years ago
8

In C, how could I use a command line input to remove certain characters from an existing string? For example, if I have string '

OXOXO' and whenever the character 'N' is put into the command line, a character from the existing string would be removed. So if the user inputs the string 'oNoN' into the command line, the new string would be 'OXO'.

Computers and Technology
1 answer:
s344n2d4d5 [400]3 years ago
6 0

Answer:

// here is code in C.

#include <stdio.h>

// main function which take input from command line

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

               // variables

               int char_count = 0, i=0;

               // string as char array

               char inp_str[100] = "OXOXO";

               //count  total number of 'N's in command line argument

               while(argv[1][i++] != '\0')

               {

                 if(argv[1][i]=='N')

                     char_count++;

               }

               // find the length string

               int l = 0;

               while(inp_str[l] != '\0')

                               l++;

               //reduce length of the string

               l = l - char_count;

               //set null char at index "l" so it will  removes character after index "l"

               inp_str[l] = '\0';

               printf("%s\n", inp_str);

               return 0;

}

Explanation:

Create a string as character array and initialize it with "OXOXO".After that count the number of "N" which come from the command line argument.Then find the length of input string.Reduce the length of string and set "null" at index "l" in the string.Then print the string.

Output:

OXO

<u>Command line argument:</u>

You might be interested in
What specific type of tools can assist teams by identifying attacks and indicators of compromise by collecting, aggregating, and
Vladimir [108]

Answer:

The specific type of tools that can assist teams by identifying attacks and indicators of compromise by collecting, aggregating, and correlating log and alert data from routers, firewalls, IDS/IPS, endpoint logs, Web filtering devices, and other security issues are:

1. Arachni

2. Grabber

3. Iron wasp

4. Nogotofail

5. SonarQube

6. SQLMap

7. W3af

8. Wapiti

9. Wfuzz

10. ZedAttack Proxy Zap

Explanation:

The testing tool is capable of uncovering a number of vulnerabilities, to scan small web applications, to uncover over 25 types of web application vulnerabilities, to detect TLS/SSL vulnerabilities and misconfigurations, to measure the source code quality of a web application, to detect and utilize SQL injection vulnerability in a website’s database, to find over 200 types of security issues in web applications, to check web applications for security vulnerabilities.

The security testing tool supports command-line access for advanced users can also be used to intercept a proxy for manually testing a webpage.

5 0
3 years ago
Which of the following website is arguably considered the best site to search for scholarships
monitta
There is no way to define the 'best' site. Each site offers a unique experience along with the fact it might not display the same information as the other ones. The APEX site (As far as I know, it is a school test site) Won't really be able to help unless you are willing to do a few tests. I would go for Scholarshipexperts.com
3 0
2 years ago
Read 2 more answers
45 points!
sertanlavr [38]
Email and cookies need SSL. Other options do not need SSL
5 0
2 years ago
Consider an unpipelined or single-stage processor design like the one discussed in slide 6 of lecture 17. At the start of a cycl
pantera1 [17]

Answer:

a. Clock Speed of Processor = 0.5 GHz

b. Cycles per Instruction (CPI) = 1 Clock per Instruction

c. Throughput = 1 billion Instruction per Second

Explanation

Given Data

Time Take to complete the single Cycle = 2000ps = 2000 x 10⁻¹²

To Find

a. Clock Speed of Processor = ?

b. Cycles per Instruction (CPI) = ?

c. Throughput = ?

Solution:

a. Clock Speed of Processor = ?

Clock Speed = 1/Time to complete the cycle

                      = 1/2000 x 10⁻¹²  Hz

                      =  0.0005 x 10¹²  Hz

                      =  0.5 x 10⁹  Hz                             as   10⁹ = 1 Giga   so,

                      = 0.5 GHz

b. Cycles per Instruction (CPI) = ?

It is mentioned that, each instruction should start at the start of the new cycle and completely processed at the end of that cycle so, we can say that Cycles per Instruction (CPI) = 1

for above mentioned processor.

c. Throughput = ?

Throughput = CPI x Clock Speed

where

CPI = 1 cycle per instruction

Clock Speed = 1 billion Instructions per Second

as

Clock Speed = 1 billion Cycles per Second

Throughput = 1 cycle per instruction x 1 billion Cycles per Second

Throughput = 1 billion Instruction per Second

                         

6 0
3 years ago
In order to be an effective employee who knows recent information on loans and laws, in what topic should your information be cu
Paraphin [41]

Answer:

industry politics

Explanation:

In order to be an effective employee who knows recent information on loans and laws, your information should be current in industry politics.

This ultimately implies that, an employee who wants to be well-informed and knowledgeable on recent informations on loans and laws, is saddled with the responsibility of gathering and sourcing for informations through industry politics. Thus, the employee must have been involved in working with various industry leaders and most likely to have interacted with various employees working there.

Industry politics can be defined as a group of policies, standards and regulations set by the government to promote and facilitate competitiveness among the private and publicly owned industries.

6 0
2 years ago
Other questions:
  • Ben buys an Olympus E-PL2 from Sony which starts malfunctioning. When he opts for an exchange, the customer representative says
    11·1 answer
  • Which of the following is NOT a benefit of safety and health programs?
    11·1 answer
  • What best describes deflation?
    9·2 answers
  • Write a program that prompts the user to enter a number then counts the number of odd numbers and even numbers the user enter. T
    15·1 answer
  • Write a Python3 program to check if 3 user entered points on the coordinate plane creates a triangle or not. Your program needs
    12·1 answer
  • Which one my guys I need help
    7·1 answer
  • Select the correct answer. Which is the bottom-most layer in the OSI model?
    9·1 answer
  • 7. Which cipher is based on the clues of the physical factors, rather than the hardware or a software cryptosystem
    8·1 answer
  • Effective online learning method for students
    5·1 answer
  • How would you explain how a password generator program works
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!