473,779 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Program Codes

3 New Member
Hello everybody... i find this place very helpful. anyone who can help me solve the following problems? Thank you very much for helping me..

1. Build a header file that consists of a class Integer. The class should be capable of computing the sum, difference, product, quotient, and factorials of two numbers. Build an implementation file that uses the newly-built ADT(Abstract Data Type) Integer

2. Write a program that will determine the intersection of the given sets:
A = {a,o,b,m,f,c,j, e,y}
B = {n,e,y,d,r,z,o, j,x}

3. Construct a program that reads a list of numbers and computes their average. After determining the average, the program will print the list with an indication of which numbers are below the average and which are above. Use dynamic arrays.

4. Design a program that (1) allocates a new array of 15 integers; (2) places the first 15 integers which are odd and divisible by 3 in the component of the new array; and (3) returns the array's memory to the heap.

5. Write a function that takes a linked list of items and deletes all repetitions from the list. Invoke this function in your main().

6. Write a function that takes a linked list of integers and outputs the highest and the lowest integer from the list. Invoke this function in your main().

7. Write a program on how to edit, insert, and delete an element of a stack.

8. Write a program on how to edit, insert, and delete an element of a queue.

9. Design a console application in C++ that will display the PreOrder(Prefix ) and PostOrder(Postf ix) of a mathematical expression. (You may use arrays or construct a struct/class for nodes to solve this problem)
Jan 9 '07 #1
6 4342
willakawill
1,646 Top Contributor
Hello everybody... i find this place very helpful. anyone who can help me solve the following problems? Thank you very much for helping me..

1. Build a header file that consists of a class Integer. The class should be capable of computing the sum, difference, product, quotient, and factorials of two numbers. Build an implementation file that uses the newly-built ADT(Abstract Data Type) Integer

2. Write a program that will determine the intersection of the given sets:
A = {a,o,b,m,f,c,j, e,y}
B = {n,e,y,d,r,z,o, j,x}

3. Construct a program that reads a list of numbers and computes their average. After determining the average, the program will print the list with an indication of which numbers are below the average and which are above. Use dynamic arrays.

4. Design a program that (1) allocates a new array of 15 integers; (2) places the first 15 integers which are odd and divisible by 3 in the component of the new array; and (3) returns the array's memory to the heap.

5. Write a function that takes a linked list of items and deletes all repetitions from the list. Invoke this function in your main().

6. Write a function that takes a linked list of integers and outputs the highest and the lowest integer from the list. Invoke this function in your main().

7. Write a program on how to edit, insert, and delete an element of a stack.

8. Write a program on how to edit, insert, and delete an element of a queue.

9. Design a console application in C++ that will display the PreOrder(Prefix ) and PostOrder(Postf ix) of a mathematical expression. (You may use arrays or construct a struct/class for nodes to solve this problem)
Nice problems. You should know that TheScripts helps those that help themselves :)
Jan 9 '07 #2
Ganon11
3,652 Recognized Expert Specialist
Yes. Please post what solutions you have come up with so far, any problems you have, etc. and we will try to give you advice and guidance.

Also, please ask for help one at a time. There will likely be someone willing to help you with, say, question 3, and later question 6, etc. but not 9 questions at once - in other words, asking for help with 9 problems is a bit overwhelming.
Jan 9 '07 #3
phkram
3 New Member
Thank you for your advice Sir Ganon11. Honestly, I could hardly contruct the C++ code for the problem set I have presented. I wish someone could offer a solution so I can study and refresh again my knowledge in C++ programming. Solutions to these two problems could help me a lot. Thank you.


1. Write a program that will determine the intersection of the given sets:
A = {a,o,b,m,f,c,j, e,y}
B = {n,e,y,d,r,z,o, j,x}


2. Construct a program that reads a list of numbers and computes their average. After determining the average, the program will print the list with an indication of which numbers are below the average and which are above. Use dynamic arrays.
Jan 11 '07 #4
Ganon11
3,652 Recognized Expert Specialist
1. Write a program that will determine the intersection of the given sets:
A = {a,o,b,m,f,c,j, e,y}
B = {n,e,y,d,r,z,o, j,x}
For the first, I assume you will be holding sets A and B in character arrays, as follows:

Expand|Select|Wrap|Line Numbers
  1. char *A, *B;
  2. A = new char[9]; // Somehow gets values a, o, b, m, f, c, j, e, y
  3. B = new char[9]; // Somehow gets values n, e, y, d, r, z, o, j, x
Now, for each element in A, (A[0], A[1], ... , A[8]), check to see if that element is present in B. You will need two loops to do this, and possibly a third character array. If the element in A is present in B, you can add this element to the third array (C). Finally, print the elements in C. Pseudocode could be:

Expand|Select|Wrap|Line Numbers
  1. char *A, *B, *C;
  2. A = new char[9]; // Somehow gets values a, o, b, m, f, c, j, e, y
  3. B = new char[9]; // Somehow gets values n, e, y, d, r, z, o, j, x
  4. C = new char[9]; // Possibly 9 values in C, but empty right now
  5. // User input to get values of A, B
  6. int sizeOfC = 0; // Variable to hold current size of C
  7. for (variable i loops from 0 to 8)
  8.     for (variable j loops from 0 to 8)
  9.         if (A[i] is the same as B[j]) {
  10.             C[sizeOfC] = A[i];
  11.             sizeOfC++;
  12.         }
  13.     }
  14. }
  15. // Print elements of C
Jan 11 '07 #5
phkram
3 New Member
Thank you very much sir.. this site really gives a lot of help and the replies are prompt.. im so thankful i found this site. i am looking forward to solution of the other problem. Im really learning a lot.
Jan 12 '07 #6
Ganon11
3,652 Recognized Expert Specialist
2. Construct a program that reads a list of numbers and computes their average. After determining the average, the program will print the list with an indication of which numbers are below the average and which are above. Use dynamic arrays.
For this, you should ask the user for how many values they will enter. Initialize an integer array of this size, and then read in the numbers one by one, storing them in the array. Once you have all the numbers in the array, it will be a simple task to compute the average - add up all the numbers and divide by the array's length. Finally, print each value and a message indicating whether its value is above, below, or equal to the average.
Jan 12 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

8
2536
by: Quentin Huo | last post by:
Hi: I want to run cacls.exe to check the user right from an ASPX page. In ASP, I can do: Set wshobj=Server.CreateObject("WScript.Shell") resobj=wshobj.Run("cmd /c echo Y| cacls c:", 0, True) Set wshobj=Nothing But I don't know how to do this in ASPX page (writen in C#).
5
4716
by: Allen | last post by:
I wrote many classes. In a class, there is a member variable which is declared as char szMTreeBuf. On both Windows XP and VxWorks, it cannot work. Then I try to declare the member variable as static char szMTreeBuf, it can work again. But when add some other function codes, it cannot run normally. I modify the class delearation, and change szMTreeBuf member variable to be local variable. Again it can run now. Why does C++ program run...
0
5543
by: 14Dallas | last post by:
Hi, I have been working with another programmer to write this code. I haven't written code in years - DBase III and Pascal - anyways, back to my code question. The program opens a file and reads the contents that are seperated by spaces, not tabs - will never be seperated by tabs as it is output from another program. The contents of the file are essiantlly 3 fields/values # # Text Field 1 will be a number from 1 to 26, Field 2 will...
1
1614
by: erickwan88 | last post by:
I want to capture the input from a writing pad and apply in vb2005 but I don't know any programming codes about it. The writing pad is connected by a USB port. Before I run the writing pad program, it can be a mouse and move around double click = normal one click click twice = normal double click When I run the writing pad program Any movement of the pen on the writing pad will only shows in the program and make Chinese words...
1
1578
by: erickwan88 | last post by:
I want to capture the input from a writing pad and apply in vb2005 but I don't know any programming codes about it. The writing pad is connected by a USB port. Before I run the writing pad program, it can be a mouse and move around double click = normal one click click twice = normal double click
0
9471
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9925
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7478
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.