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
White raven [17]
3 years ago
5

In this lab, you open a file and read input from that file in a prewritten C program. The program should read and print the name

s of flowers and whether they are grown in shade or sun. The data is stored in the input file named flowers.dat. Instructions Ensure the source code file named Flowers.cpp is open in the code editor. Declare the variables you will need. Write the C statements that will open the input file flowers.dat for reading. Write a while loop to read the input until EOF is reached. In the body of the loop, print the name of each flower and where it can be grown (sun or shade). Execute the program by clicking the Run button at the bottom of the screen.
Computers and Technology
1 answer:
Bezzdna [24]3 years ago
5 0

Answer:

#include <stdio.h>

#include <string.h>

void main( )

{

array flowerProp[2];

FILE *fp; // file pointer

char flower[255]; // creating a char array to store data

fp = fopen("flowers.dat","r");

if (fp == NULL){

   printf("File flower.dat does not exist");

   return;

}

// assuming the growing condition is next line to the flower name.

while(fscanf(fp, "%s", flower)!=EOF){

   flowerProp.push(flower);

   if (flowerProp.length == 2){

       printf("%s: %s\n ", flowerProp[0], flowerProp[1]);

       memset(flowerProp, 0,0);

   }

}    

fclose (fp );

}

Explanation:

The algorithm creates a pointer to the memory location to the file starting position, the character size is used to get a string from the file line by line. Then it opens and checks if the file exists.

If the file exists, the while gets the name and growth condition of the flower, saves it to an array, prints the name and condition, and clears the array for the next flower type in the loop.

You might be interested in
Which software development team memeber is responsible for the timeline and budget
Sliva [168]

Answer:

The Project Manager

Explanation:

This person's job is to manage the project budget and map out how much time would be spent on each phase. Also his/her job is to ensure that all deliverables and on time.

7 0
3 years ago
A database with a(n) _______________ data structure can easily handle a many-to-many data relationship. hierarchical network rel
AlexFokin [52]
Hello <span>Jeffstephens124</span><span>


Answer: A database with a(n) network data structure can easily handle a many-to-many data relationship. 

Hope this helps
-Chris</span>
3 0
3 years ago
Most common level of education for a programmer or software developer
shusha [124]

c/c+ also java would be one

8 0
3 years ago
What mechanism can organizations use to prevent accidental changes by authorized users?.
AlladinOne [14]

The process of monitoring and managing changes to software code is known as version control, commonly referred to as source control.  Version control ensures that two users cannot update the same object.

<h3>What is meant by Version control?</h3>

A series of software engineering tools called version control regulates how changes are made to texts, sizable websites, computer programmes, and other collections of information. Version control is a component of software configuration management.

Version control, often known as source control, is the process of keeping track of and controlling changes to software code. Version control systems are computer programmes that help software development teams keep track of changes to source code over time.

Version control improves teamwork and communication while assisting software development teams in keeping track of code changes. Version control enables straightforward, ongoing programme development.

To learn more about version control refer to:

brainly.com/question/26533170

#SPJ4

4 0
2 years ago
Two technicians are discussing using a lift to raise a vehicle. Technician A says to be sure the lift pads on the lift are conta
lianna [129]
Its B no doubt
cuz ik how to do this i took classes for this so ik im right ight
6 0
3 years ago
Read 2 more answers
Other questions:
  • Write an application that encodes English-language phrases into pig Latin. Pig Latin is a form of coded language. There are many
    8·1 answer
  • What is an online alternative to customers sending checks via mail?
    7·1 answer
  • What is an advantage of sharing documents in PDF format instead of Word format?
    6·2 answers
  • What are the four requirements of a linear programming​ problem?
    8·1 answer
  • I found a random Nether Portal in my Minecraft Singleplayer world. Why is it there?
    8·2 answers
  • A new repair technician reports that he or she is having trouble installing the operating system. The problem arises when he or
    5·2 answers
  • Students who respond promptly to e-mails are following which netiquette rule?
    13·2 answers
  • Write a function named "higher_lower" that takes an int as a parameter and returns "higher" if 14 is greater than the input and
    11·1 answer
  • The labels on the tab buttons on the Driver tab of the Windows Device are Driver Details, Update Driver, Roll Back Driver, Unins
    12·1 answer
  • 3) Given that HSI (360, 0.000, 1.000), What is the equivalent RGB<br> color?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!