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]
4 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]4 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
is this website just for a bunch of lazy kids bumming off answers? Because if that were the case I'd be one of them.
Orlov [11]
No, in fact. Brainly is to help people who are having homework trouble, but not to just give out answers. The best answers on Brainly are the ones that explain in a simple way how they got their answer, and (obviously) that it's correct. If you need help on homework, then try and make sure your question is clear and appropriate. You'll most likely get better luck if you place it in the correct subject, and better answers if they can understand it. Also make sure when you answer questions that it's clear, simple, appropriate, and (again, obviously) correct.

<span>I hope this helped! Please take the time to rate, pick the Brainliest answer (not necessarily mine!), and thank me if you feel I helped with this question! Thank you, it helps me a lot. :)</span>

5 0
3 years ago
Which function can you use to capture the contents of an open window?
zloy xaker [14]

Answer:

To capture the contents of the currently active window, press Alt-PrtScrn (or Alt-Print Screen ). To capture the contents of the entire screen, press PrtScrn (or Print Screen ) by itself.

hope it helps you

make me brainliest plz

8 0
2 years ago
Which type of topology describes the physical arrangement, installation, and connection of cables, computer, and other devices?
Nutka1998 [239]
<span>The network topology describes the physical arrangement, installation, and connection of cables, computer, and other devices.
The network topology can be bus topology (a</span><span> network topology that uses a single cable or conductor to connect all nodes on the network.) ,</span>star topology (a network topology in which cables running from each node connect to a single point, such as a hub.), ring (a network topology that consists of a single cable that runs continuously from node to node), mesh, hybrid, hub topology,... according the arrangement of the nodes. 

8 0
3 years ago
Read 2 more answers
A type of sensor used to detect which way around a device is being held. ​
Marta_Voda [28]
There’s 3 main ones accelerometer, gyroscope, and magnetometer.
8 0
3 years ago
Which of these statements are true of verifying that a program’s code is fixed? Check all of the boxes that apply.
aksik [14]

Answer:

Its C.

Explanation:

hope it helps !

mark me brainliest :))

7 0
3 years ago
Read 2 more answers
Other questions:
  • He following is a string of ASCII characters whose bit patterns have been converted into hexadecimal for compactness: 4A EF 68 6
    12·1 answer
  • Which domain suffixes do businesses that sell products and services commonly use?
    9·2 answers
  • PLEASE HELP!
    6·2 answers
  • Write an expression that computes the integer average of the int variables exam1 and exam2 (both declared and assigned values).
    15·1 answer
  • In most operating systems what is running application called?
    5·1 answer
  • A friend is interested in keeping track of information about his album collection. He is not concerned about whether or not the
    11·1 answer
  • Write a program in java to enter a character.The program displays the message "uppercase vowel" if entered character is uppercas
    5·1 answer
  • . Find the supplements of : 150' and 70°​
    8·1 answer
  • Which one of these is NOT an indicator that an email is spam?
    5·1 answer
  • What type of attack uses many systems to flood the resources of a target, thus making the target unavailable?.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!