Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 15th, 2004, 11:53 PM
Registered User
 
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to oasis Send a message via Yahoo to oasis
Default Help needed.

I have to write a program for one of my classes and I'm kinda confused on what to do.

Here's the prog assignment:
==

A Gray Code is a sequence of binary numbers such that the numbers differ in exactly one bit. For example, a 2 bit Gray Code is 00, 01, 11, 10.

You are to write a program that:

1. has two global constants representing the number of rows and columns of a two-dimensional array
2. within main( ), creates an array using the global constants
3. reads an integer length (which represents the length of the requested Gray Code) from a file c:\gray.dat
4. within another function, fills the array with the Gray Code using array indexing notation, e.g., a[i]. Each entry of the array will be either a 0 or a 1.
5. within another function, writes your Gray Code to the file c:\gray.out using pointer notation, e.g., *aPtr, without using indices

The maximum number of columns for the array is 8; you need to determine the appropriate maximum number of rows.

There are a number of algorithms for calculating a Gray Code of a specific length. You are to use the following one:
1. a Gray Code of length 1 contains two numbers 0 and 1
2. a Gray Code of length n + 1 can be constructed from one of length n (call it GCn) by taking GCn and attaching a 0 at the end of each term in the sequence, then reversing the GCn and appending a 1 to each of the terms.

==

Any help would be greatly appreciated.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed ramabharti Javascript How-To 1 December 7th, 2006 06:42 AM
Help needed rrvinod ADO.NET 0 October 5th, 2006 09:44 AM
help needed! paquito Beginning PHP 2 November 16th, 2005 11:51 AM
A Little help needed matthew01 ASP.NET 1.0 and 1.1 Basics 3 November 9th, 2005 11:29 AM
help needed kfarooq Java Databases 1 June 27th, 2003 05:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.