473,386 Members | 1,803 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,386 software developers and data experts.

C ++ question

Dear all,
Below is the question :

Array manipulations, Class, Exception handling, Generic class.

- design, implement and test a set class in c++ that provides the
operations; set membership, set intersection, set union and set diferrence.
An array is to be used to represent a set within a class.

hope you all can help. thank you.

regards,
Michael

Jul 22 '05 #1
4 997
NPC

"tmnet" <cs***@tm.net.my> wrote in message
news:40**********@news.tm.net.my...
Dear all,
Below is the question :

Array manipulations, Class, Exception handling, Generic class.

- design, implement and test a set class in c++ that provides the
operations; set membership, set intersection, set union and set diferrence. An array is to be used to represent a set within a class.

hope you all can help. thank you.

regards,
Michael


Of course some of us can help.

#include <set>

std::set<WhateverTypeUWant> mySet;

OR

#include <vector> // Some array-like data structure
#include <algorithm> // several set-manipulation algorithms

Now, as for us doing your homework for you... I suggest a data structures
book - preferably in C++ if that is the language you are using (but isn't
necessary). Data structures/algorithms can be a lot of fun - they are very
fundamental to all of computer science - fortunately, they also require some
thought and education on the subject. You won't be getting your degree any
time soon if you have others do such fundamental work for you. Believe it
or not, these types of concepts are used in every aspect of computer
science. The sooner you become educated on them, the better off you will be
here.

-NPC
Jul 22 '05 #2
tmnet wrote:
[ blatant "do my homework" request redacted]

Should we just email it directly to your instructor?
Jul 22 '05 #3
"tmnet" <cs***@tm.net.my> wrote
Dear all,
Below is the question :

Array manipulations, Class, Exception handling,
Generic class.

- design, implement and test a set class in c++ that
provides the operations; set membership, set
intersection, set union and set diferrence. An array
is to be used to represent a set within a class.

hope you all can help. thank you.


What will you do when you're at a job interview? Ask for access to the
Internet so you can beg people for an answer to the questions you're being
asked? NO ONE will hire someone who can't think for himself.

I'm being completely serious about this: if you can't solve those kinds of
problems on your own, drop the discipline because you'll just end up
unemployed. Maybe you'd make a good lawyer or a good doctor or a good
mechanic, but no one makes it in the software field without being a problem
solver.

Claudio Puviani
Jul 22 '05 #4
"tmnet" <cs***@tm.net.my> wrote:
Dear all,
Below is the question :

Array manipulations, Class, Exception handling, Generic class.

- design, implement and test a set class in c++ that provides the
operations; set membership, set intersection, set union and set diferrence.
An array is to be used to represent a set within a class.

hope you all can help. thank you.


//--------------------------------------------------------------------
#include "Set.h"
#include <string>
#include <sstream>

template < typename T >
void check( const T& expected, const T& got )
{
if ( !(expected == got) ) {
std::cerr << "Expected: '" << expected
<< "' got: '" << got << "'" << std::endl;
abort();
}
}

int main()
{
using namespace std;
Set s;
s.addItem( 5 );
check( true, s.contains( 5 ) );

cout << "OK";
}
//--------------------------------------------------------------------

Start with the above. When you try to compile it, a list of errors will
be generated. Fix the first error and then try again. Keep doing this
until it compiles. When it finally runs, start changing what you wrote
until the program prints "OK" on the screen.

Then show me what you have so far and I'll give you another test.
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mohammed Mazid | last post by:
Can anyone please help me on how to move to the next and previous question? Here is a snippet of my code: Private Sub cmdNext_Click() End Sub Private Sub cmdPrevious_Click() showrecord
3
by: Stevey | last post by:
I have the following XML file... <?xml version="1.0"?> <animals> <animal> <name>Tiger</name> <questions> <question index="0">true</question> <question index="1">true</question> </questions>
7
by: nospam | last post by:
Ok, 3rd or is it the 4th time I have asked this question on Partial Types, so, since it seems to me that Partial Types is still in the design or development stages at Microsoft, I am going to ask...
3
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
53
by: Jeff | last post by:
In the function below, can size ever be 0 (zero)? char *clc_strdup(const char * CLC_RESTRICT s) { size_t size; char *p; clc_assert_not_null(clc_strdup, s); size = strlen(s) + 1;
56
by: spibou | last post by:
In the statement "a *= expression" is expression assumed to be parenthesized ? For example if I write "a *= b+c" is this the same as "a = a * (b+c)" or "a = a * b+c" ?
2
by: Allan Ebdrup | last post by:
Hi, I'm trying to render a Matrix question in my ASP.Net 2.0 page, A matrix question is a question where you have several options that can all be rated according to several possible ratings (from...
3
by: Zhang Weiwu | last post by:
Hello! I wrote this: ..required-question p:after { content: "*"; } Corresponding HTML: <div class="required-question"><p>Question Text</p><input /></div> <div...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...

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.