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
katrin [286]
3 years ago
11

Write a main function to do the following: Create a string that can hold up to 30 characters. Create an array of 10 strings with

room for 60 characters plus the null byte. Prompt the user and read the name of an input file into your string. Open the file for input. Call your function to read from the file into the array. Read into all 10 strings. Call your function to remove the newlines at the end of all of the strings. Call your function to print all of the strings. Print the smallest string. Change all of the strings to uppercase. Print all of the strings again.

Computers and Technology
1 answer:
masha68 [24]3 years ago
6 0

Answer:

Check the explanation

Explanation:

#// do comment if any problem arises

//code

#include <stdio.h>

#include <ctype.h>

#include <string.h>

#include <stdlib.h>

void read(FILE *input, char array[10][61])

{

   // read all 10 strings

   for (int i = 0; i < 10; i++)

       fgets(array[i], 60, input);

}

void remove_newline(char array[10][61])

{

   for (int i = 0; i < 10; i++)

   {

       array[i][strlen(array[i]) - 1] = '\0';

   }

}

void smallest(char array[10][61])

{

   int s = 0;

   for (int i = 1; i < 10; i++)

   {

       if (strlen(array[s]) > strlen(array[i]))

           s = i;

   }

   printf("\nSmallest strnig: %s\n", array[s]);

}

void upper(char array[10][61])

{

   for (int i = 0; i < 10; i++)

   {

       int n = strlen(array[i]);

       for (int j = 0; j < n; j++)

       {

           array[i][j] = toupper(array[i][j]);

       }

   }

}

int main()

{

   char filename[30];

   // array of 10 strings

   char array[10][61];

   printf("Enter filename: ");

   gets(filename);

   // open file

   FILE *input = fopen(filename, "r");

   // read into array

   read(input, array);

   // close file

   fclose(input);

   // remove newline

   remove_newline(array);

   // print

   printf("Contents of file:\n");

   for (int i = 0; i < 10; i++)

       printf("%s\n", array[i]);

   // print smallest string

   smallest(array);

   // uppercase

   upper(array);

   // print again

   printf("\nContents of file after converting to uppercase:\n");

   for (int i = 0; i < 10; i++)

       printf("%s\n", array[i]);

}

kindly check the attached image below to see the Output:

You might be interested in
A search for reliable information is a search for what?
Nadusha1986 [10]

Answer:

For information you can trust

Explanation:

8 0
3 years ago
5. The shell of a document that may be used over and over in desktop publishing is called a
Blababa [14]
The answer is B) Template. 

Various templates are available in most all desktop publishing programs, from resume templates in Word to Income Statement templates in Excel. Templates are useful for skipping the general "setup" process of making a document, and allow you to focus more on filling the document with the relevant data and polishing it to your specific needs once most of the legwork is done. 
6 0
3 years ago
Read 2 more answers
Your isp connects to the core routers of the internet via a _____. cable mode spine backbone satellite
melisa1 [442]

fairly certain its backbone

5 0
4 years ago
If you are writing an algorithm and you aren’t confident that you understand the problem, what can you do?
Zigmanuir [339]

Answer:

divide it into smaller pieces

Explanation:

Usually, the main reason a programmer does not understand a problem fully is that there is too much information. The best way to try and fully understand a problem is to divide it into smaller pieces. Start off by answering the question what is the expected output for an input. Then divide each individual issue within the problem. This will allow you as a programmer/developer to create an individual solution for each individual issue within the problem and then test to make sure that the input gives the correct output.

8 0
3 years ago
One type of CAPTCHA is ________. a rootkit virus the wavy hard-to-read letter and number sequence that you type to prove that yo
sergejj [24]
<h2>password method</h2>

Explanation:

Rootkit virus is one type of virus which is hidden about its existence and tries to affect the maximum number of system.

Password method: This is a graphical method to identify the text hidden in the signature and confirming that it is not a robot or any other system to protect the system from hacking. This would be really hard-to-read and thus ensures safety.

Antivirus software: This is a system to protect the system, when the virus tries to attack the system. An indication will be given through the software to the user.

4 0
3 years ago
Other questions:
  • After several incidents in __________ the company’s computer systems were not ready to support new products, the CEO established
    12·1 answer
  • A user states that when they power on their computer, they receive a "Non-bootable drive" error. The user works with external st
    8·1 answer
  • #We've started a recursive function below called #measure_string that should take in one string parameter, #myStr, and returns i
    5·1 answer
  • What are digital forensic techniques? A. Identifying, extracting, and evaluating evidence obtained from digital media such as co
    11·1 answer
  • Who was the father of computer​
    10·1 answer
  • Examples of system software include operating systems like macos, Linux, Android and
    10·2 answers
  • Compare the graphs. Find the value of h, k, or a.
    7·1 answer
  • . In this project, how many times will the [Drive] block be repeated?
    15·1 answer
  • Discuss the advantages and disadvantages of supporting links to files that cross mount points (that is, the file link refers to
    6·1 answer
  • If you want to create a line of code that will not appear in the interpreter, what symbol should begin the line?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!