473,326 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Program Codes

3
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(Postfix) of a mathematical expression. (You may use arrays or construct a struct/class for nodes to solve this problem)
Jan 9 '07 #1
6 4320
willakawill
1,646 1GB
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(Postfix) 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 Expert 2GB
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
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 Expert 2GB
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
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 Expert 2GB
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
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)...
5
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...
0
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...
1
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...
1
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.