C++ assignment
Now to you people this stuff will be rediculously simple but I am very new to C++ and have an assignment that I am having much trouble with. I understand the basic things that need to be done in each but keep receiving small errors such as undeclared identifier. IF you guys can help with any of these I would be quite appreciative!
1. Complete the program activity.c as described in the comments. For marking purposes run your program 3 times with inputs -20, 20, and 30.
/* File: activity.c
Programmer: your name Date:
Course: ENGM2081 Instructor: Mansour/Phillips
You have taken a job at a year-round resort where the owner has just
installed a computerized sign. You are to program the sign to show
the current temperature and a recommended activity.
Your program should read the temperature from the keyboard and
print out the activity appropriate for that temperature using the
following guidelines:
Activity Temperature
---------------------------------------- ------
Swimming 30 < temperature
Tennis 20 < temperature <= 30
Golf 0 < temperature <= 20
Skiing -17 < temperature <= 0
Dancing temperature <= -17
---------------------------------------- ------
*/
#include
1. Complete the program activity.c as described in the comments. For marking purposes run your program 3 times with inputs -20, 20, and 30.
/* File: activity.c
Programmer: your name Date:
Course: ENGM2081 Instructor: Mansour/Phillips
You have taken a job at a year-round resort where the owner has just
installed a computerized sign. You are to program the sign to show
the current temperature and a recommended activity.
Your program should read the temperature from the keyboard and
print out the activity appropriate for that temperature using the
following guidelines:
Activity Temperature
----------------------------------------
Swimming 30 < temperature
Tennis 20 < temperature <= 30
Golf 0 < temperature <= 20
Skiing -17 < temperature <= 0
Dancing temperature <= -17
----------------------------------------
*/
#include
[Error: Irreparable invalid markup ('<stdio.h>') in entry. Owner must fix manually. Raw contents below.]
Now to you people this stuff will be rediculously simple but I am very new to C++ and have an assignment that I am having much trouble with. I understand the basic things that need to be done in each but keep receiving small errors such as undeclared identifier. IF you guys can help with any of these I would be quite appreciative!
<lj-cut text="Assignment Problems">
1. Complete the program activity.c as described in the comments. For marking purposes run your program 3 times with inputs -20, 20, and 30.
/* File: activity.c
Programmer: your name Date:
Course: ENGM2081 Instructor: Mansour/Phillips
You have taken a job at a year-round resort where the owner has just
installed a computerized sign. You are to program the sign to show
the current temperature and a recommended activity.
Your program should read the temperature from the keyboard and
print out the activity appropriate for that temperature using the
following guidelines:
Activity Temperature
----------------------------------------------
Swimming 30 < temperature
Tennis 20 < temperature <= 30
Golf 0 < temperature <= 20
Skiing -17 < temperature <= 0
Dancing temperature <= -17
----------------------------------------------
*/
#include <stdio.h>
int main(void)
{
FILE* out = fopen("activity.out", "a");
/* You fill in here */
return 0;
}
2, Complete the program smog.c as described in the comments. For marking purposes run your program 3 times with values (again appending the results to the output file):
ozone nitrogen dioxide carbon monoxide
----------------------------------------------------
300 100 100
200 250 150
100 150 100
/* File: smog.c
Programmer: your name Date: Sept.
Course: ENGM2081 Instructor: Mansour/Phillips
Los Angeles sometimes has very smoggy conditions. These conditions are
largely due to L.A.'s location between mountain ranges, coupled with
prevailing winds off the ocean that tend to blow pollutants from the
city's many automobiles up against the mountains. Three components of
smog - ozone, nitrogen dioxide, and carbon monoxide - are a particular
health concern. A pollutant hazard index has been developed for each of
the three primary irritants. If any index rises above 100, the air is
listed as ``unhealthy'' in forecasts to Los Angeles residents. If the
index for any one of the three rises above 200, a ``first-stage smog
alert'' is issued and certain activities are restricted in the affected
part of the Los Angeles basin. If an index goes over 275, a
``second-stage alert'' is called and more severe restrictions apply.
Write a program that takes as inpute the daily hazard index for each of
the three pollutants and that identifies unhealthy or first- or
second-stage alert situations.
This program reads in three components of smog -- ozone, nitrogen
dioxide, and carbon monoxide and outputs a pollutant hazard index
Sample program ouptput:
ozone level: 110
nitrogen dioxide level: 210
carbon monoxide level: 150
first stage smog alert */
#include <stdio.h>
int main(void)
{
FILE* out = fopen("smog.out", "a");
/* You fill in here */
return 0;
}
3. Write the program, quadrant.c, which takes the - coordinates (integers) of a point in the plane and displays a message telling either an axis on which the point lies or a quadrant in which it is found. Note that the program should not print out a quadrant if the point lies on an axis. Also, if the point is the origin then that alone should be printed. See the program template below for the quadrant number scheme.
Run your program for the following values to make sure that it is working: (1,2), (1,-2), (0,1), (-1,-2), (2,0), (-2,1), and (0,0) (again appending the results to the output file).
/* File: quadrant.c
Programmer: your name Date:
Course: ENGM2081 Instructor: Mansour/Phillips
This program reads in the coordinates of a point in the plane and
displays a message telling either an axis on which the point lies
or a quadrant in which it is found. Note that the program does
not print out a quadrant if the point lies on an axis and
if the point is the origin then that alone should be printed
^ y axis
|
|
Q2 | Q1
|
|
----------------+---------------> x axis
|
Q3 | Q4
|
|
|*/
#include <stdio.h>
int main(void)
{
FILE* out = fopen("quadrant.out", "a");
/* you fill in here */
return 0;
}
</lj-cut>
<lj-cut text="Assignment Problems">
1. Complete the program activity.c as described in the comments. For marking purposes run your program 3 times with inputs -20, 20, and 30.
/* File: activity.c
Programmer: your name Date:
Course: ENGM2081 Instructor: Mansour/Phillips
You have taken a job at a year-round resort where the owner has just
installed a computerized sign. You are to program the sign to show
the current temperature and a recommended activity.
Your program should read the temperature from the keyboard and
print out the activity appropriate for that temperature using the
following guidelines:
Activity Temperature
----------------------------------------------
Swimming 30 < temperature
Tennis 20 < temperature <= 30
Golf 0 < temperature <= 20
Skiing -17 < temperature <= 0
Dancing temperature <= -17
----------------------------------------------
*/
#include <stdio.h>
int main(void)
{
FILE* out = fopen("activity.out", "a");
/* You fill in here */
return 0;
}
2, Complete the program smog.c as described in the comments. For marking purposes run your program 3 times with values (again appending the results to the output file):
ozone nitrogen dioxide carbon monoxide
----------------------------------------------------
300 100 100
200 250 150
100 150 100
/* File: smog.c
Programmer: your name Date: Sept.
Course: ENGM2081 Instructor: Mansour/Phillips
Los Angeles sometimes has very smoggy conditions. These conditions are
largely due to L.A.'s location between mountain ranges, coupled with
prevailing winds off the ocean that tend to blow pollutants from the
city's many automobiles up against the mountains. Three components of
smog - ozone, nitrogen dioxide, and carbon monoxide - are a particular
health concern. A pollutant hazard index has been developed for each of
the three primary irritants. If any index rises above 100, the air is
listed as ``unhealthy'' in forecasts to Los Angeles residents. If the
index for any one of the three rises above 200, a ``first-stage smog
alert'' is issued and certain activities are restricted in the affected
part of the Los Angeles basin. If an index goes over 275, a
``second-stage alert'' is called and more severe restrictions apply.
Write a program that takes as inpute the daily hazard index for each of
the three pollutants and that identifies unhealthy or first- or
second-stage alert situations.
This program reads in three components of smog -- ozone, nitrogen
dioxide, and carbon monoxide and outputs a pollutant hazard index
Sample program ouptput:
ozone level: 110
nitrogen dioxide level: 210
carbon monoxide level: 150
first stage smog alert */
#include <stdio.h>
int main(void)
{
FILE* out = fopen("smog.out", "a");
/* You fill in here */
return 0;
}
3. Write the program, quadrant.c, which takes the - coordinates (integers) of a point in the plane and displays a message telling either an axis on which the point lies or a quadrant in which it is found. Note that the program should not print out a quadrant if the point lies on an axis. Also, if the point is the origin then that alone should be printed. See the program template below for the quadrant number scheme.
Run your program for the following values to make sure that it is working: (1,2), (1,-2), (0,1), (-1,-2), (2,0), (-2,1), and (0,0) (again appending the results to the output file).
/* File: quadrant.c
Programmer: your name Date:
Course: ENGM2081 Instructor: Mansour/Phillips
This program reads in the coordinates of a point in the plane and
displays a message telling either an axis on which the point lies
or a quadrant in which it is found. Note that the program does
not print out a quadrant if the point lies on an axis and
if the point is the origin then that alone should be printed
^ y axis
|
|
Q2 | Q1
|
|
----------------+---------------> x axis
|
Q3 | Q4
|
|
|*/
#include <stdio.h>
int main(void)
{
FILE* out = fopen("quadrant.out", "a");
/* you fill in here */
return 0;
}
</lj-cut>
