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
LiRa [457]
3 years ago
13

(1) Prompt the user for a string that contains two strings separated by a comma. (1 pt) Examples of strings that can be accepted

: Jill, Allen Jill , Allen Jill,Allen Ex: Enter input string: Jill, Allen (2) Report an error if the input string does not contain a comma. Continue to prompt until a valid string is entered. Note: If the input contains a comma, then assume that the input also contains two strings. (2 pts) Ex: Enter input string: Jill Allen Error: No comma in string Enter input string: Jill, Allen (3) Extract the two words from the input string and remove any spaces. Store the strings in two separate variables and output the strings. (2 pts) Ex: Enter input string: Jill, Allen First word: Jill Second word: Allen (4) Using a loop, extend the program to handle multiple lines of input. Continue until the user enters q to quit. (2 pts) Ex: Enter input string: Jill, Allen First word: Jill Second word: Allen Enter input string: Golden , Monkey First word: Golden Second word: Monkey Enter input string: Washington,DC First word: Washington Second word: DC Enter input string: q

Computers and Technology
1 answer:
denis-greek [22]3 years ago
4 0

Answer:

Check the explanation

Explanation:

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

#define MAX_LIMIT 50

int checkComma(char *input)

{

int flag = 0;

for(int i = 0; i < strlen(input); i++)

{

if(input[i] == ',')

{

flag = 1;

break;

}

}

return flag;

}

int main(void)

{

char input[MAX_LIMIT];

char *words[2];

char delim[] = ", ";

printf("\n");

do

{

printf("Enter input string: ");

fgets(input, MAX_LIMIT, stdin);

size_t ln = strlen(input) - 1;

if (*input && input[ln] == '\n')

input[ln] = '\0';

if(strcmp(input, "q") == 0)

{

printf("Thank you...Exiting\n\n");

exit(1);

}

else

{

if(checkComma(input) == 0)

{

printf("No comma in string.\n\n");

}

else

{

char *ptr = strtok(input, delim);

int count = 0;

while(ptr != NULL)

{

words[count++] = ptr;

ptr = strtok(NULL, delim);

}

printf("First word: %s\n", words[0]);

printf("Second word: %s\n\n", words[1]);

}

}

}while(strcmp(input, "q") != 0);

return 0;

}

Kindly check the attached image below for the output.

You might be interested in
When spraying pesticide wear and protective eyeglass​
exis [7]
Ummmmmmmmmmmmmmmmmmmmm ok
6 0
3 years ago
Read 2 more answers
Which biometric technique is considered nearly infallible from a scientific point of view and is increasingly preferred by crimi
Sergio039 [100]

Answer:

DNA analysis

Explanation:

DNA is unique for all individuals. DNA analysis is the process of analysing the DNA characteristics of an individual.

DNA profiling is used in forensics to identify the suspects involved in criminal activities.

1. In the process, DNA of the suspects is matched with the DNA found in the site of the crime.

2. If a match is found, it indicates that the genetic relationship exists between the suspect and the criminal or the crim.

3. The order from the court is needed to obtain the DNA of the suspects. The sample can be in the form of blood or saliva.

4. The sample obtained should have adequate cells which contain the DNA.

Issues  

The DNA obtained from the crime site is not pure or proper enough to be ideal for the DNA profiling.

Degraded sample

1. The sample obtained from the site of the crime is not always adequate to obtain the actual DNA.

2. The sample can be contaminated due to the environmental factors.

3. The sample obtained is too less and hence, should be examined accurately in order not to waste the sample.

DNA mixture

4. The sample obtained from the site of the crime is found to contain DNA from more than one individual.

 

Profiling types

DNA profiling can be carried out by using any of the techniques mentioned below.

1. RFLP analysis (  Restriction fragment length polymorphism )

This uses the Southern blot technique. The blot process needs a large amount of the sample. Also, this works well only when the sample is not degraded.

2. Polymerase chain reaction (PCR) analysis

3. STR analysis ( short tandem repeats )

4. AFLP ( amplified fragment length polymorphism )

This is an automated and low-cost process. It is easy to set up and operate which makes this process common in low income countries.

All the methods mentioned above have their own advantages and drawbacks.

5 0
3 years ago
Containers for contaminated sharps must have several characteristics. What’s missing from the list? PuContainers for contaminate
Nadya [2.5K]
All sharps containers must be stored upright,be puncture-resistant, be labeled or color-coded red & leakproof on both the sides & the bottom! The last one is the one missing!
4 0
3 years ago
Read 2 more answers
True or False? A supervisory control and data acquisition (SCADA) device is a computer that controls motors, valves, and other d
Gekata [30.6K]

Answer:

The correct answer to the following question will be "True".

Explanation:

SCADA is a hardware and software elements program that permits industrial enterprises to:

  • Agricultural processes are regulated locally or globally.
  • The human-machine interaction program specifically interfaces with equipment such as cameras, switches, generators, motors and much more.
  • Track, store, and process the data in real-time.

Therefore, the given statement is true.

4 0
3 years ago
The trademarked name of the accepted standard for configuring wireless networks is _______________
enyata [817]

Answer:

WiFi

Explanation:

WiFi is a standard wireless network configuration developed by IEEE (Institute of Electrical and Electronics Engineers) as a 802.11 standard.

WiFi is embedded in chips in computers and configured for finding wireless routers. WiFi certified points can identify each other, this standardized networks are available almost all online electronic devices.  

Wi-Fi Alliance is the authority to certify devices which satisfy the IEEE 802.11 standards.

3 0
3 years ago
Other questions:
  • g The reciprocal Fibonacci constant ψ is defined by the infinite sum: ψ=∑n=1 [infinity] 1 Fn Where Fn are the Fibonacci numbers
    7·1 answer
  • Describe three general methods for passing parameters to the operating system.
    6·1 answer
  • What Is the output of the following: =OR (5 &lt;7, 16*Rand ()&gt;23,FALSE)
    5·1 answer
  • Computers heat resistant materials breathing systems for fire fighters food-growing technologies improvements in all of the item
    14·1 answer
  • Company XYZ has a new employee named John Anderson. His employee ID is XYZ1234. His email address will be <a href="/cdn-cgi/l/em
    10·1 answer
  • Define a class, addresstype, that can store a street address, city, state, and zip code. use the appropriate functions to print
    11·1 answer
  • Login
    11·1 answer
  • Cable Internet access can be described with which feature?
    5·2 answers
  • How to convert binary to decimal <br> Please it’s so hard and what is digital and analogue
    9·1 answer
  • Prior to the 1996 NEC, ____ receptacles and cords were permitted. However, now it is mandatory that a separate equipment groundi
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!