944,079 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 738
  • C++ RSS
Jun 4th, 2007
0

Help

Expand Post »
Dear All,
Please help me regarding this C++ Assignment.
Q.1
Write a program using malloc function. In which you take input from user and allocate memory equal to square of this number. Which multiply numbers and draw a table in the following format?

Hint: User enters 3 then program allocates equal to 9 integer memories.

Output:1

Enter a single digit number:
2
The multiplication table of 2 is:
1 2
----------------
1| 1 2
2| 2 4

Output:2

Enter a single digit number:
4
The multiplication table of 4 is:
1 2 3 4
--------------------------------
1| 1 2 3 4
2| 2 4 6 8
3| 3 6 9 12
4| 4 8 12 16

Q.2
Write a macros in which swap two number without using 3rd variable and then call
Macro in main function.

Hint: a=4, b=2 after swapping a=2, b=4.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
faisaly is offline Offline
21 posts
since May 2007
Reputation Points: 32
Solved Threads: 4
Practically a Master Poster
jaepi is offline Offline
647 posts
since Jul 2006
Jun 4th, 2007
0

Re: Help

Also, pick better subjects. http://catb.org/~esr/faqs/smart-questions.html#bespecific
You may as well have posted a blank message for all the good that "help" does.

> Write a macros in which swap two number without using 3rd variable
Not this old chestnut.

malloc and crusty macro hacks in C++ - I'm really not that impressed with your "teacher".
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Data validation- want only Int's
Next Thread in C++ Forum Timeline: Doesn't open for file input successfully.... why?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC