×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Please Help! a.s.a.p!!!!!!!!!!!!!!!!!!!!!!!!!!

Please Help! a.s.a.p!!!!!!!!!!!!!!!!!!!!!!!!!!

Please Help! a.s.a.p!!!!!!!!!!!!!!!!!!!!!!!!!!

(OP)
email: k0008990@kingston.ac.uk
Exercise 1
The following is a function declaration for finding the area of a rectangle.
int rectangle_area(int width, int height);
Implement a function for finding the area of a rectangle.
Use the following code to test your program
// author
// date
// title
#include <iostream.h>
int rectangle_area(int width, int height);
void main()
{
int w, h;// width and height of rectangle
int a;// area
cout << "What is the width of the rectangle? " << endl;
cin >> w;
cout << "What is the height of the rectangle?" << endl;
cin >> h;
a = rectangle_area(w, h);
cout << "The area of the rectangle is " << a << endl;
}
// rest of the code goes here
Exercise 2
You have previously written a program for displaying times-tables, e.g.
1 x 2 = 2
2 x 2 = 4
2 x 3 = 6...
Write a function called void table(int x) which prints out the x times tables.
The following code should be used for testing the program...
// Times Tables Tester
// date
// author
#include <iostream.h>
void table(int x);
void main()
{
for (int i=1;i<=12;i++)
table(i);// display i times table
}
// rest of your code...
Exercise 3
Write a function:
float CtoF(float C)
which converts degrees Centigrade to Fahrenheight
and a second function:
float FtoC(float F)
which converts degrees Fahrenheit to Centigrade.
The formula is C = (F-32)*5/9
The main program runs in a loop, asking the user which conversion they want to do (or 0 to exit), and then a value for the temperature. The program should display the converted temperature.
If the following temperatures are entered, the program should print out an informational message:
TemperatureMessage
<273CInvalid temperature - below absolute zero!
0CFreezing point of water
100CBoiling point of water
>5000CHotter than temperature of the Sun
Hint: the temperatures are shown in degrees Centigrade.
Exercise 4
A large number of functions to do maths are available, when you add the line
#include <math.h>
to the top of your program.
These include:
double sin(double alpha)
double cos(double alpha)
double tan(double alpha)
double sqrt(double x)
For the trig functions, angle alpha is in radians.
To convert from radians to degrees, use:
angle_in_deg = angle_in_rad*180/PI;
where const double PI = 3.14159;
Problem:
The figure below shows a person looking at a high wall.
Write a function:
double height_of_wall(double p, double alpha, double d)
which returns the height of the wall.
Exercise 5
A. Write a function:
int odd(int x)
which returns 1 if x is odd, and 0 otherwise
B. Write a function:
int isPositive(int x)
which returns 1 if x is positive, and 0 otherwise
TRICKY...
C. Write a function
int isPrime(int x)
which returns 1 if x is a prime number, and 0 otherwise

RE: Please Help! a.s.a.p!!!!!!!!!!!!!!!!!!!!!!!!!!

hello timtiny,

i think you should do your homework by yourself. these are exercises from the very beginning of c and you can find the solutions in nearly every beginner - c - tutorial.
download some an you will drag and drop and never learn how to program i c.


noka

RE: Please Help! a.s.a.p!!!!!!!!!!!!!!!!!!!!!!!!!!

well the functions that he needs should be the same in c/c++.

wont be able to compile his test programs with a C compiler though.

RE: Please Help! a.s.a.p!!!!!!!!!!!!!!!!!!!!!!!!!!

(OP)
I wanted to do c course how will i start my studies, would we get any online materials to study and write the exams and get certification from the brain bench.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close