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
Is it possible to code your own game and if so then where should I go to learn and how to publish it?
const2013 [10]

Answer:

Yes there is

Explanation:

It is scratch a coding game to do almost anything you can also code flappybird

Hope this helps.

Have fun with scratch

4 0
2 years ago
Read 2 more answers
What subsection of the Internet requires specialized browser to access and is frequently used by cyber criminals and underground
kotykmax [81]

Answer:

c. Dark Web                                                

Explanation:

Surface web is also called visible web is a part of world wide web that can be easily searchable using search engines as its contents are indexed by the search engines such as Google and its contents are accessible by public using standard web browsers. So a is not a suitable choice.

Deep Web is called invisible web as it is not accessible or searchable to standard search engines like Google. Search engines cannot index the contents of these sites. However such sites do not requires specialized browsers to access. So b is not a suitable choice.

Dark Web: It is a part of Deep Web sites but it requires specialized software and browsers to access. These sites cannot be indexed and cannot be searchable through standard search engines. This is also called dark side of the world wide web darker which is frequently used by criminals, hackers, black markets, hit-men. Illegal activities on a massive level is takes place in the dark web such as access to stolen sensitive information, malware, drug trade and terrorist operations. These sites are temporary and keep changing addresses to lessen the risk of getting caught by govt agencies or security officials. So c is the suitable choice.

Crypto-Net is a kind of neural network which works with encrypted data which can make a prediction based on the data without disclosing the data and prediction to the 3rd party. So d is not a suitable option.

6 0
3 years ago
____ is an integrated system that collects and processes data and manages and coordinates resources, information, and functions
miss Akunina [59]

Answer:

a.) Enterprise Resource Planning  

Explanation:

5 0
3 years ago
Three periods after a menu item (…) mean that clicking that command will open
otez555 [7]
<h2>Answer:</h2>

Option B: a dialog box

Three periods after a menu item (…) mean that clicking that command will open a dialog box.

<h2>Explanation:</h2>
  • The three periods after items in menus are given a special name "ellipsis".
  • As the space for an item name is less for complete description, ellipsis is used.
  • Ellipsis lead to dialog box that elaborates the function of the item.
  • The person can then select the item depending on the need as well as reject it completely.
  • So in other words, ellipsis allow users to understand the command completely and choose what to do next.

<h3>I hope it will help you! </h3>
8 0
4 years ago
What limited the possibilities of game development from a technical viewpoint?
lyudmila [28]

Answer:

1)Estimation of the game project

2) Development of Prototype

.

3) Reproduction Stage

4)Communication

5) Polish

Explanation:

The limited the possibilities of game development from a technical viewpoint are the reason why some of developers in gaming are diverting away into another area of computer technology. Some of these limiting factors are;

1):Estimation of the resources needed for the game development which is hard most especially for video games and some of the reasons is that the industry is fast changing. And there are things to be estimated such as time,is there any need bro change the code.

2)Development of Prototype of the game in other to

Know if a feature is valid can be a problematic process.and to know where to perform modifications.

3) Reproduction Stage:

This one of the main limiting problem in almost every game development , and this usually occur when a game ships, reproduction stage is skipped. And without proper preproduction, there will be no coherence in product.

4) Most of the Video games can be easily ruined by bugs and features that is badly executed. And this is where polishing comes in, polishing can be really demanding.

5 0
3 years ago
Other questions:
  • Define a function begins_with_line that consumes a string and returns a boolean indicating whether the string begins with a dash
    15·1 answer
  • a supermarket having a sale on canned foods' the sale includes 12 cans of soup for 10.65 what is the unit price per can of soup
    6·2 answers
  • 9. What is the difference between a hand-drawn sketch, a working drawing, and a 3D model?
    14·1 answer
  • The page orientation in which the page width is greater than the page height is called
    8·1 answer
  • The system partition is the partition that contains the files required to load the operating system (bootmgr, and BCD). The syst
    9·1 answer
  • Margie has found a stock template to use. She changes a few things about the formatting and then saves the
    7·2 answers
  • Your customer said that understanding the directions is difficult. This is an aspect of
    6·1 answer
  • I know I'm asking for a lot. But this is my last question. If we do it I pass my semester. help please.
    15·1 answer
  • What is the purpose of memory address?​
    9·2 answers
  • Write a Pascal program that will prompt the user to enter the radius of a circle.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!