Hi there,
This is the first participation in this site, & I want to help me
would you mind answering this questions, pleeeeeease:icon_cry:

========
((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;

Recommended Answers

All 8 Replies

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.

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...

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".

why doesn't anybody help me..:icon_cry:

Because you aren't asking for help, you are asking for all the work to be done for you.

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:

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

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...

An introduction to classes can be found e.g. here
http://www.cplusplus.com/doc/tutorial/classes.html

how to write answer with CLASS...

To output something to screen, even from within your class, you can use cout.
An example:

#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 ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.