| | |
Write a C++ program, I need help
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
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;
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.
•
•
Join Date: Mar 2008
Posts: 62
Reputation:
Solved Threads: 7
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.
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.
•
•
Join Date: Jan 2008
Posts: 3,822
Reputation:
Solved Threads: 501
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.
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:
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
C++ Syntax (Toggle Plain Text)
class Calculator { //class attributes and such things } int Calculator::Display_sum(int Number1, int Number2) { //addition and return code }
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
Makes it easier on everyone: http://www.daniweb.com/forums/thread78223.html
AJAX, PHP, C#, C++, JAVA
•
•
Join Date: Nov 2007
Posts: 978
Reputation:
Solved Threads: 208
An introduction to classes can be found e.g. here
http://www.cplusplus.com/doc/tutorial/classes.html
To output something to screen, even from within your class, you can use cout.
An example:
Just get to it and you'll solve it piece by piece ...
http://www.cplusplus.com/doc/tutorial/classes.html
To output something to screen, even from within your class, you can use cout.
An example:
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; int main() { int value = 123; cout << "This is text followed followed by a number: " << value << endl; return 0; }
Just get to it and you'll solve it piece by piece ...
![]() |
Similar Threads
- how to write a program for power (C)
- Please some one write this program (C++)
- How can I write this program. (C++)
- How can I write a program with 3 classes? (C)
- How to write a program using a stack (C++)
- Trying to write a program that you can enter #s and multiply at the end. (Java)
- write a program that simulates rooling a pair of dice. (Java)
Other Threads in the C++ Forum
- Previous Thread: Searching word for word
- Next Thread: how do I read backspace (getchar)?
| Thread Tools | Search this Thread |
api array arrays based binary c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game generator givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






