Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Assignment help please!!! (http://www.velocityreviews.com/forums/t283373-assignment-help-please.html)

Cam 05-28-2004 12:06 PM

Assignment help please!!!
 
Hi everyone,

I have written a C++ assignment using VS.NET and have been asked to modify
it to run under Unix. I have removed all errors when compiling except that I
can't get the Sun compiler to use the CONIO.H library.

I have used the getche and getch functions that CONIO.H provides.

I have added the CONIO.H file into the same directory as the *.cpp file but
that doesn't seem to help.

This has nothing to do with the completion of the assignment as the
assignment has already been submitted. I just need to get it to compile
under Unix.

Is there an alternative library that will provide similar functions?

ANY help would be greatly appreciated.

Regards,

Cam Telford



Rolf Magnus 05-28-2004 12:19 PM

Re: Assignment help please!!!
 
"Cam" <retsigerymmudathotmaildotcom> wrote:

> Hi everyone,
>
> I have written a C++ assignment using VS.NET and have been asked to
> modify it to run under Unix. I have removed all errors when compiling
> except that I can't get the Sun compiler to use the CONIO.H library.


CONIO.H is not a library. It's a header file.

> I have used the getche and getch functions that CONIO.H provides.


>
> I have added the CONIO.H file into the same directory as the *.cpp
> file but that doesn't seem to help.


A header only tells the compiler, which functions are available. You
still need an implementation of those functions.

> This has nothing to do with the completion of the assignment as the
> assignment has already been submitted.


Your subject says something different.

> I just need to get it to compile under Unix.
>
> Is there an alternative library that will provide similar functions?


Have a look at ncurses.


Cam 05-28-2004 12:32 PM

Re: Assignment help please!!!
 
Hi Rolf,

Please pardon my poor syntax ... I am teaching myself C++ as I go.

The code was written for an assignment and I have written and compiled the
code using MS VS.NET. The lecturer asked if I could compile the code to run
on the Unix system used by the Uni.

As the assignment has already been submitted, I do not consider asking the
NG for help cheating. If I believed that it was cheating, I wouldn't do it!

I have not done a lot of work in C++ and was quite pleased with the fact
that I was able to write the required code in the first place :o)

The code was to get the user to input two signed, binary numbers and carry
out arithmetic on these numbers without converting them to decimal to do the
actual operations.

I used getche to gather the input from the user and place each bit of the
input into a separate array element. This made the binary processsing much
easier.

I have converted most of the code to run on the Sun system, but am unable to
get the Sun system to recognise # include <conio.h>.

Is conio.h a Microsoft only header?

Will ncurses perform the same job as getche?

Thanks for your help.

Cheers,

Cam



John Harrison 05-28-2004 12:42 PM

Re: Assignment help please!!!
 
> I have converted most of the code to run on the Sun system, but am unable
to
> get the Sun system to recognise # include <conio.h>.
>
> Is conio.h a Microsoft only header?


It's a platform specific header

>
> Will ncurses perform the same job as getche?


It's also platform specific.

Just use getchar as a replacement for getche. It does almost the same thing
and its standard so will work on any C++ platform. getchar is declared in
the header <stdio.h>. There's no need for platform specific functions for
what you are attempting.

john




Cam 05-28-2004 12:44 PM

Re: Assignment help please!!!
 
Thanks John,

I'll give it a try.

If I want to try and learn non-platform specific C++, where's a good place
to start? Any good books?

Cheers,

Cam


"John Harrison" <john_andronicus@hotmail.com> wrote in message
news:2hoqa8Ffi4njU1@uni-berlin.de...
| > I have converted most of the code to run on the Sun system, but am
unable
| to
| > get the Sun system to recognise # include <conio.h>.
| >
| > Is conio.h a Microsoft only header?
|
| It's a platform specific header
|
| >
| > Will ncurses perform the same job as getche?
|
| It's also platform specific.
|
| Just use getchar as a replacement for getche. It does almost the same
thing
| and its standard so will work on any C++ platform. getchar is declared in
| the header <stdio.h>. There's no need for platform specific functions for
| what you are attempting.
|
| john
|
|
|



Petec 05-28-2004 12:58 PM

Re: Assignment help please!!!
 
Cam wrote:
> Thanks John,
>
> I'll give it a try.
>
> If I want to try and learn non-platform specific C++, where's a good
> place to start? Any good books?
>
> Cheers,
>
> Cam
>


Please don't top post.


"Thinking in C++" by Bruce Eckel is availible legally and free online on his
website, and is quite an excellent book.
Bjarne Stroustrup's "The C++ Programming Language" is also a must-have book
for standard C++.

- Pete



Cam 05-28-2004 01:04 PM

Re: Assignment help please!!!
 
What's "top posting"?



Buster 05-28-2004 01:14 PM

Re: Assignment help please!!!
 
Cam wrote:
> What's "top posting"?


See the FAQ for this newsgroup (search the web for "C++ FAQ", then
find the section on "netiquette").

--
Regards,
Buster.

Victor Bazarov 05-28-2004 01:23 PM

Re: Assignment help please!!!
 
This is.

Cam wrote:
> What's "top posting"?


Cam 05-28-2004 01:28 PM

Re: Assignment help please!!!
 
I looked up 'top posting' and that was not what I was doing. My reply to
someone who was kind enough to answer my question was placed under their
reply. I shall, however, try to observe netiquette ...

OK ... so I have been advised that conio.h and getche are platform specific
and that I should use stdio.h and getchar. The problem is that getchar does
not seem to work the same way that getche does. Getchar seems to require
something other than just the keypress.

I need a non-platform specific function that will accept a single keypress
and return the character code for the key pressed to allow the placement if
individual characters into an array.

I would like to assure anyone who is able to help me out that i am not
getting the NG to do my homework.

I have done loads of research on the net and through books prior to
selecting getche as my initial function and haven't been able to find
anything that does exactly the same job.

An alternative would be REALLY appreciated.

Thanks to all,

Cheers,

Cam




All times are GMT. The time now is 02:18 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.