C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

memory

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C Language
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Fri May 04, 2007 4:58 am    Post subject: memory Reply with quote



Write a C/C++ program to extract any fractional decimal number (for
example, 15, 15.0, 0.15 or .15) between the strings "Hello " and "
World!" (for example, "Hello 1.124 World!"), then return a float.
float ExtractFloat(const char *str)
{
....
}

Write a C/C++ function to allocate memory always aligned at a 16 byte
boundary.
int * AllocAlignedMemory(int numBytes)
{
....
}

Write a C/C++ program to reverse the bits in a 32-bit unsigned
integer.
unsigned int ReverseBits(unsigned int u)
{
....
}
Back to top
Michael Ekstrand
Guest





PostPosted: Fri May 04, 2007 4:58 am    Post subject: Re: memory Reply with quote



On Thu, 03 May 2007 16:58:08 -0700, n.noumia wrote:
Quote:
Write a C/C++ program
request for homework snipped

1. There is no such language. There is C, and there is C++, but C/C++
does not exist.
2. Nobody here does other people's homework for them. Please do it
yourself. If you are stuck on a particular problem, feel free to ask
questions here, but please provide the code you're already trying and a
description of your specific difficulty.

- Michael
Back to top
Dave Vandervies
Guest





PostPosted: Fri May 04, 2007 4:58 am    Post subject: Re: memory Reply with quote



In article <f1dt8f$6io$1 (AT) aioe (DOT) org>,
Michael Ekstrand <usenet (AT) elehack (DOT) net> wrote:
Quote:
On Thu, 03 May 2007 16:58:08 -0700, n.noumia wrote:
Write a C/C++ program
request for homework snipped

1. There is no such language. There is C, and there is C++, but C/C++
does not exist.

I have vague memories of a language called C\C++ that somebody here
implemented, though. He might be thinking of that.

Quote:
2. Nobody here does other people's homework for them.

Sure we do. I just posted answers for somebody's binary tree homework;
I'm sure his teacher will definitely enjoy reading them, and maybe even
give him some pity marks.


dave

--
Dave Vandervies dj3vande (AT) csclub (DOT) uwaterloo.ca
Hey, I can beat him on the Impressive But Useless certificates thing.
I have a PhD.
--Dan Holdsworth in the scary devil monastery
Back to top
Beej Jorgensen
Guest





PostPosted: Fri May 04, 2007 5:06 am    Post subject: Re: memory Reply with quote

<n.noumia (AT) gmail (DOT) com> wrote:
Quote:
Write a C/C++ program to reverse the bits in a 32-bit unsigned
integer.
unsigned int ReverseBits(unsigned int u)
{
...
}

Lookup table. 32 is only 24 more than 8.

-Beej
Back to top
Keith Thompson
Guest





PostPosted: Fri May 04, 2007 5:56 am    Post subject: Re: memory Reply with quote

n.noumia (AT) gmail (DOT) com writes:
Quote:
Write a C/C++ program to extract any fractional decimal number (for
example, 15, 15.0, 0.15 or .15) between the strings "Hello " and "
World!" (for example, "Hello 1.124 World!"), then return a float.
float ExtractFloat(const char *str)
{
...
}

Write a C/C++ function to allocate memory always aligned at a 16 byte
boundary.
int * AllocAlignedMemory(int numBytes)
{
...
}

Write a C/C++ program to reverse the bits in a 32-bit unsigned
integer.
unsigned int ReverseBits(unsigned int u)
{
...
}

Give us your instructor's e-mail address so I can submit the solution
directly. Don't worry, I'll be sure to mention your name.

Please provide a reference manual and implementation for this "C/C++"
language. I'm familiar with the C and C++ languages, but not with
"C/C++".

We'll discuss my consulting fees later; you can expect them to be
substantial.

Or you might consider not being a lazy slob and doing your own damned
homework rather than asking others to cheat for you. Just a thought.

--
Keith Thompson (The_Other_Keith) kst-u (AT) mib (DOT) org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to top
J. J. Farrell
Guest





PostPosted: Fri May 04, 2007 7:25 am    Post subject: Re: memory Reply with quote

On May 3, 4:58 pm, n.nou...@gmail.com wrote:
Quote:
Write a C/C++ program

What is "C/C++"?

Quote:
to extract any fractional decimal number (for
example, 15, 15.0, 0.15 or .15) between the strings "Hello " and "
World!" (for example, "Hello 1.124 World!"), then return a float.

Why should I? You don't even say please.

Did you have a question about C, or just some orders for us about "C/C+
+"?
Back to top
Eric Sosman
Guest





PostPosted: Fri May 04, 2007 8:04 am    Post subject: Re: memory Reply with quote

n.noumia (AT) gmail (DOT) com wrote:
Quote:
Write a C/C++ program to extract any fractional decimal number (for
example, 15, 15.0, 0.15 or .15) between the strings "Hello " and "
World!" (for example, "Hello 1.124 World!"), then return a float.
float ExtractFloat(const char *str)
{
...
}

float ExtractFloat(const char *str) {
/* Returns "a float," as specified */
return 42.0f;
}

Quote:
Write a C/C++ function to allocate memory always aligned at a 16 byte
boundary.
int * AllocAlignedMemory(int numBytes)
{
...
}

Not possible in portable C.

Quote:
Write a C/C++ program to reverse the bits in a 32-bit unsigned
integer.
unsigned int ReverseBits(unsigned int u)
{
...
}

unsigned int ReverseBits(unsigned int u) {
/* Reverses the bits of "a" 32-bit unsigned
* integer. To reverse other 32-bit unsigned
* integers, write additional functions.
*/
return 0xd1ef00L;
}

--
Eric Sosman
esosman@acm-dot-org.invalid
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C Language All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.