Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Any c++ pros out there?

Reply
Thread Tools

Any c++ pros out there?

 
 
ragav.payne@googlemail.com
Guest
Posts: n/a
 
      03-26-2006
Here's my problem, i need to do a c++ program for my project at
school using structures. All my friends have submitted theirs and no
two should have the same project. jus' gi mme an out of the box idea
please. i can do with writing the source code.

 
Reply With Quote
 
 
 
 
W Marsh
Guest
Posts: n/a
 
      03-26-2006
On 26 Mar 2006 06:13:26 -0800, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> Here's my problem, i need to do a c++ program for my project at
>school using structures. All my friends have submitted theirs and no
>two should have the same project. jus' gi mme an out of the box idea
>please. i can do with writing the source code.


Here's a good structure:

struct empty
{
};
 
Reply With Quote
 
 
 
 
Rolf Magnus
Guest
Posts: n/a
 
      03-26-2006
(E-Mail Removed) wrote:

> Here's my problem, i need to do a c++ program for my project at
> school using structures. All my friends have submitted theirs and no
> two should have the same project. jus' gi mme an out of the box idea
> please. i can do with writing the source code.


Maybe you should go to your professor to get some inspiration. From my
experience they are usually willing to give you that kind of help.
For people in the newsgroup, it's a bit hard to give you some suggestions,
because you didn't say how much time is planned, if you're doing it alone
or in a group and whether you may (or even must?) use some external
libraries.

 
Reply With Quote
 
Kai-Uwe Bux
Guest
Posts: n/a
 
      03-26-2006
W Marsh wrote:

> On 26 Mar 2006 06:13:26 -0800, (E-Mail Removed) wrote:
>
>> Here's my problem, i need to do a c++ program for my project at
>>school using structures. All my friends have submitted theirs and no
>>two should have the same project. jus' gi mme an out of the box idea
>>please. i can do with writing the source code.

>
> Here's a good structure:
>
> struct empty
> {
> };


In order to make this more useful, you should provide a better interface.
This is what I use:

struct empty {};

std:stream & operator<< ( std:stream & ostr, empty const & e ) {
return( ostr << '#' );
}

std::istream & operator>> ( std::istream & istr, empty & e ) {
char chr;
istr >> chr;
if ( chr != '#' ) {
istr.setstate( std::ios_base::failbit );
}
return( istr );
}

bool operator== ( empty a, empty b ) {
return( true );
}

bool operator!= ( empty a, empty b ) {
return( false );
}

bool operator< ( empty a, empty b ) {
return( false );
}

bool operator<= ( empty a, empty b ) {
return( true );
}

bool operator> ( empty a, empty b ) {
return( false );
}

bool operator>= ( empty a, empty b ) {
return( true );
}


Best

Kai-Uwe Bux
 
Reply With Quote
 
ragav.payne@googlemail.com
Guest
Posts: n/a
 
      03-26-2006

Rolf Magnus wrote:
> (E-Mail Removed) wrote:
>
> > Here's my problem, i need to do a c++ program for my project at
> > school using structures. All my friends have submitted theirs and no
> > two should have the same project. jus' gi mme an out of the box idea
> > please. i can do with writing the source code.

>
> Maybe you should go to your professor to get some inspiration. From my
> experience they are usually willing to give you that kind of help.
> For people in the newsgroup, it's a bit hard to give you some suggestions,
> because you didn't say how much time is planned, if you're doing it alone
> or in a group and whether you may (or even must?) use some external
> libraries


Actually this is a group(max 4) project and has to be completed within
end of may.
all my friends have already proposed their ideas to the prof. and as
there should'nt be any repetition everybody has to get an unusual idea.

i did my part really well. i went to her and told about a program which
would accept a sentence and give an output of the same sentence in
morse code(using different delay times in the frequencies) but
unfortunately someone had proposed the idea earlier, that just kept me
wondering whether i could get another idea such as that.
please help!!!!

 
Reply With Quote
 
rAgAv
Guest
Posts: n/a
 
      03-26-2006

Kai-Uwe Bux wrote:
> W Marsh wrote:
>
> > On 26 Mar 2006 06:13:26 -0800, (E-Mail Removed) wrote:
> >
> >> Here's my problem, i need to do a c++ program for my project at
> >>school using structures. All my friends have submitted theirs and no
> >>two should have the same project. jus' gi mme an out of the box idea
> >>please. i can do with writing the source code.

> >
> > Here's a good structure:
> >
> > struct empty
> > {
> > };

>
> In order to make this more useful, you should provide a better interface.
> This is what I use:
>
> struct empty {};
>
> std:stream & operator<< ( std:stream & ostr, empty const & e ) {
> return( ostr << '#' );
> }
>
> std::istream & operator>> ( std::istream & istr, empty & e ) {
> char chr;
> istr >> chr;
> if ( chr != '#' ) {
> istr.setstate( std::ios_base::failbit );
> }
> return( istr );
> }
>
> bool operator== ( empty a, empty b ) {
> return( true );
> }
>
> bool operator!= ( empty a, empty b ) {
> return( false );
> }
>
> bool operator< ( empty a, empty b ) {
> return( false );
> }
>
> bool operator<= ( empty a, empty b ) {
> return( true );
> }
>
> bool operator> ( empty a, empty b ) {
> return( false );
> }
>
> bool operator>= ( empty a, empty b ) {
> return( true );
> }
>
>
> Best
>
> Kai-Uwe Bux



nice try dude!

Well a program with structure is something which everybody can do but,
wat i need to do is a program which can be used in real life, not just
something which returns true/ false

 
Reply With Quote
 
Daniel T.
Guest
Posts: n/a
 
      03-26-2006
In article <(E-Mail Removed) .com>,
(E-Mail Removed) wrote:

> Here's my problem, i need to do a c++ program for my project at
> school using structures. All my friends have submitted theirs and no
> two should have the same project. jus' gi mme an out of the box idea
> please. i can do with writing the source code.


So you need an interesting problem that can be done in about a month by
four beginners?

How about one of the exorcises from Bjarne Stroustrup's book?

Exorcise 2 from section 12.7 should be quite interesting.


--
Magic depends on tradition and belief. It does not welcome observation,
nor does it profit by experiment. On the other hand, science is based
on experience; it is open to correction by observation and experiment.
 
Reply With Quote
 
Kai-Uwe Bux
Guest
Posts: n/a
 
      03-26-2006
rAgAv wrote:

>
> Kai-Uwe Bux wrote:
>> W Marsh wrote:
>>
>> > On 26 Mar 2006 06:13:26 -0800, (E-Mail Removed) wrote:
>> >
>> >> Here's my problem, i need to do a c++ program for my project at
>> >>school using structures. All my friends have submitted theirs and no
>> >>two should have the same project. jus' gi mme an out of the box idea
>> >>please. i can do with writing the source code.
>> >
>> > Here's a good structure:
>> >
>> > struct empty
>> > {
>> > };

>>
>> In order to make this more useful, you should provide a better interface.
>> This is what I use:
>>
>> struct empty {};
>>
>> std:stream & operator<< ( std:stream & ostr, empty const & e ) {
>> return( ostr << '#' );
>> }
>>
>> std::istream & operator>> ( std::istream & istr, empty & e ) {
>> char chr;
>> istr >> chr;
>> if ( chr != '#' ) {
>> istr.setstate( std::ios_base::failbit );
>> }
>> return( istr );
>> }
>>
>> bool operator== ( empty a, empty b ) {
>> return( true );
>> }
>>
>> bool operator!= ( empty a, empty b ) {
>> return( false );
>> }
>>
>> bool operator< ( empty a, empty b ) {
>> return( false );
>> }
>>
>> bool operator<= ( empty a, empty b ) {
>> return( true );
>> }
>>
>> bool operator> ( empty a, empty b ) {
>> return( false );
>> }
>>
>> bool operator>= ( empty a, empty b ) {
>> return( true );
>> }
>>
>>
>> Best
>>
>> Kai-Uwe Bux

>
>
> nice try dude!
>
> Well a program with structure is something which everybody can do but,
> wat i need to do is a program which can be used in real life, not just
> something which returns true/ false


You may fail to see the significance, however, the code above is directly
copied from my library and has proved to be useful in the past. I leave it
up to your imagination (or your skillful use of Google) to figure out why
you may want a class like this.


As for something you might try: implement a box-container (also something
that proved useful in my library; and I know it can be done with a
reasonable amount of effort):

Specifications:

template < typename T >
class box;

A box can be empty or contain an element of type T. Boxes are default
constructible (yielding the empty box), copy-constructible, assignable.
Also, comparisons for boxes are defined:

the empty box is greater than any non-empty box.
non-empty boxes compare according to content.

Finally, box<T> has members:

bool empty () const; // returns true if the box is empty.
T & item (); // returns a handle to the contents.
T const & item () const; // returns a handle to the contents.
void clear(); // empties the box.
void put ( T const & t ); // puts a copy of t into the box.
box<T> ( T const & t ); // construct a box containing a copy of t.

Maybe that qualifies as an "out of the box idea".


Best

Kai-Uwe Bux
 
Reply With Quote
 
=?ISO-8859-1?Q?Martin_J=F8rgensen?=
Guest
Posts: n/a
 
      03-26-2006
(E-Mail Removed) wrote:
-snip-

> i did my part really well. i went to her and told about a program which
> would accept a sentence and give an output of the same sentence in
> morse code(using different delay times in the frequencies) but
> unfortunately someone had proposed the idea earlier, that just kept me
> wondering whether i could get another idea such as that.
> please help!!!!


Then make a program that converts morse code back again to something
understandable.


Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
 
Reply With Quote
 
Ben Pope
Guest
Posts: n/a
 
      03-27-2006
Daniel T. wrote:
>
> How about one of the exorcises from Bjarne Stroustrup's book?


Do you think C++ could save Emily Rose?

Ben Pope
--
I'm not just a number. To many, I'm known as a string...
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check out your Computer display like the pros. Spurious Response DVD Video 0 07-27-2007 11:26 AM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
PSL pros and cons Kumar Vijay Mishra VHDL 2 10-02-2004 12:34 AM
Any pros/cons on the Canon Pro1? Duffer Digital Photography 3 07-19-2004 01:50 AM
jobless Recovery, many IT pros out of work Joe A+ Certification 6 02-08-2004 05:13 AM



Advertisments