Write a C++ program, I need help

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2008
Posts: 4
Reputation: Queen of Dreams is an unknown quantity at this point 
Solved Threads: 0
Queen of Dreams's Avatar
Queen of Dreams Queen of Dreams is offline Offline
Newbie Poster

Write a C++ program, I need help

 
0
  #1
Mar 8th, 2008
Hi there,
This is the first participation in this site, & I want to help me
would you mind answering this questions, pleeeeeease


========
((1))
Write a C++ program that do the following:
a.Define a class called Calculator.
b.Declare the object Cal of type Calculator.
c.Define a member function Display_sum that receive two parameters Number1 and Number2 then print the sum of these two numbers.
d.Define a member function Display_multiply that receive two parameters Number1 and Number2 then print the multiplication of these two numbers.
e.Test your function.

========
((2))
Write a C++ program that do the following:
a.Define a class called HotelRoom.
b.Declare Room1002 as an object of HotelRoom.
c.Define a member function called ShowRoomInfo to print room_number, floor_number and type that receive as parameters.
d.Define a member function called CheckRoomStatus to check the availability of a room according to the value of its integer parameters .If it is 1-> booked, 0->not booked.
e.Test your function.

========
((3))
Write a C++ program that do the following:
a.Define a class called Date.
b.Declare Birth_Date as an object of Date.
c.Define a member function called PrintInfo to print the Day, Month and Year values in the format 01-01-2000 that receive as parameters.
d.Define a member function called Calculate_age that calculates the difference between your birth date (receive its information as arguments) and the current date that read from the user .The result will be as a number of days.
e.Test your function.

========
((4))
Write a C++ program that do the following:
a.Define a class called Rectangle:
b.Declare Rec as an object of Rectangle.
c.Define a member function called perimeter that calculates and prints rectangle’s perimeter .Receive rectangle’s length and width as parameters.
(Note: perimeter= 2* (length+width).
d.Define a member function called area that calculates and prints rectangle’s area. Receive rectangle’s length and width as parameters
(Note: area= length*width).
e.Test your function.

========
((5))
Write a C++ program that read two strings and do the following:
•Print the length of each string.
•Print the largest string.
•Compare the two strings and print the first one alphabetically.
•Compare the first three characters of the first string with the second string and prints the first one alphabetically.
•Copy the first string into the second string.
•Copy the first four characters from the second string to the first string.
•Copy the first string to the end of second string.
•Copy the first two characters from the second string to the end of first string.
•Print the address of the first occurrence of ‘a’ in the first string.
•Print the address of the last occurrence of ‘a’ in the second string.
•Print the address of the first occurrence of “abc” in the first string;
Last edited by Queen of Dreams; Mar 8th, 2008 at 2:39 pm.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 62
Reputation: Joatmon is an unknown quantity at this point 
Solved Threads: 7
Joatmon Joatmon is offline Offline
Junior Poster in Training

Re: Write a C++ program, I need help

 
0
  #2
Mar 8th, 2008
http://www.daniweb.com/forums/announcement8-2.html

Please make an effort to solve the problems yourself, and if you still need help, tell us what specifically you need help with after posting some of your code segments that aren't working.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 4
Reputation: Queen of Dreams is an unknown quantity at this point 
Solved Threads: 0
Queen of Dreams's Avatar
Queen of Dreams Queen of Dreams is offline Offline
Newbie Poster

Re: Write a C++ program, I need help

 
0
  #3
Mar 8th, 2008
I am a beginner in C++, Being this is the first given question asking me to write a prgram, I don't know how to answer it..
please answer any question you know...
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,822
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 501
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: Write a C++ program, I need help

 
0
  #4
Mar 8th, 2008
Originally Posted by Queen of Dreams View Post
I am a beginner in C++, Being this is the first given question asking me to write a prgram, I don't know how to answer it..
please answer any question you know...
This is your first C++ program? I've never heard of a teacher or an employer assigning this type of program as a first assignment. Usually you start out with "Hello World".
Last edited by VernonDozier; Mar 8th, 2008 at 4:00 pm.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 4
Reputation: Queen of Dreams is an unknown quantity at this point 
Solved Threads: 0
Queen of Dreams's Avatar
Queen of Dreams Queen of Dreams is offline Offline
Newbie Poster

Re: Write a C++ program, I need help

 
0
  #5
Mar 8th, 2008
why doesn't anybody help me..
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 62
Reputation: Joatmon is an unknown quantity at this point 
Solved Threads: 7
Joatmon Joatmon is offline Offline
Junior Poster in Training

Re: Write a C++ program, I need help

 
0
  #6
Mar 8th, 2008
Because you aren't asking for help, you are asking for all the work to be done for you.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 111
Reputation: jesseb07 is on a distinguished road 
Solved Threads: 15
jesseb07's Avatar
jesseb07 jesseb07 is offline Offline
Junior Poster

Re: Write a C++ program, I need help

 
0
  #7
Mar 8th, 2008
ok, I have a hard time believing that this is the first program required of you, but whatever. Starting with the first one, you'll need to research classes and member functions. The basics of which would be the following in your case:

  1. class Calculator
  2. {
  3. //class attributes and such things
  4. }
  5.  
  6. int Calculator::Display_sum(int Number1, int Number2)
  7. {
  8. //addition and return code
  9. }

See what you can get from there. Seems like many of those questions use the same principles based on this.

We are better able (and more willing) to give help when specific questions are asked as well as posting what was attempted prior to asking. We will not do your homework for you.

~J
Last edited by jesseb07; Mar 8th, 2008 at 4:52 pm.
Ps. 121

Makes it easier on everyone: http://www.daniweb.com/forums/thread78223.html

AJAX, PHP, C#, C++, JAVA
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 4
Reputation: Queen of Dreams is an unknown quantity at this point 
Solved Threads: 0
Queen of Dreams's Avatar
Queen of Dreams Queen of Dreams is offline Offline
Newbie Poster

Re: Write a C++ program, I need help

 
0
  #8
Mar 8th, 2008
with use class,yes this is the first time to write program with class
and i don't know how to write answer with CLASS...
thank you jesseb07 for helping me...
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 978
Reputation: mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice 
Solved Threads: 208
mitrmkar mitrmkar is offline Offline
Posting Shark

Re: Write a C++ program, I need help

 
0
  #9
Mar 8th, 2008
An introduction to classes can be found e.g. here
http://www.cplusplus.com/doc/tutorial/classes.html
Originally Posted by Queen of Dreams View Post
how to write answer with CLASS...
To output something to screen, even from within your class, you can use cout.
An example:
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int value = 123;
  6. cout << "This is text followed followed by a number: " << value << endl;
  7. return 0;
  8. }

Just get to it and you'll solve it piece by piece ...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC