Miley Cyrus

Help with Programming in C?

by Miley on Dec.01, 2011, under Wii Accessories

Help with Programming in C?

So for my programming class right now we are currently working with character arrays, strings and string functions, and pointers, to give you an idea of how much C I know. For this lab we have to take a txt file with up to 100 random words in it and display them on the screen in 5 columns. Then using simple input from a wiimote the user will select a word from the list and when selected it will appear on the bottom of the screen and each next word chosen will add itself to the last word making a sentence at the bottom of the screen. Here is a copy of the lab requirements and instructions.

Lab 10: WiiTalker

Objectives:
• Practice Top-Down Program Design, Problem Solving in C
• Practice Strings and Arrays in C.

Due: During your TAs office hours during finals week or in next week’s lab. Your TA may
make special hours available for check offs during finals week.

People with speaking disabilities and limited mobility, such as famed physicist Stephen
Hawking, often use speech synthesizers controlled by a simple input device.
In this lab, we will write a tool that allows the user to generate sentences of text using the
wiimote as input. This could then feed a speech synthesizer program.

Your program will take a file name as a command line argument. The file will contain a list of up
to 100 words, one per line. Each word will not exceed 10 characters. Your code should present
the words in five columns (“%15s” perhaps) on the screen. A sample word file can be
downloaded from http://www.ece.iastate.edu/~daniels/words.txt Note: you will need to use
ncurses as in wiimaze. Instead of using printf, you should use the mvprintw function. Its
prototype looks like: void mvprintw(int row, int col, char * format, arg1, arg2, arg3…). Hence,
you can use it like mvprintw(3, 10, “%d is an integer”, 55) which will print 55 is an integer
starting at row 3 in column 10; Be sure to call the refresh() function every time you want the
screen to update.

Develop an input method so that a user can select one of the displayed words using the wiimote.
(It could be the arrow buttons on the wiimote, tilt and pitch, or other choice. DOCUMENT
AND JUSTIFY YOUR CHOICE IN YOUR CODE COMMENTS.) You should indicate the
word currently selected by placing a character next to it using the function used in Wiimaze.

Begin with an empty sentence at the bottom of the screen. The A button will append a space to
the current sentence followed by the selected word. The B button will remove the last word
added. The 1 button will append the word but without adding a space. (OPTIONAL: the 2
button will capitalize the first letter of the next word appended.)

Update the current sentence at the bottom of the screen as words are added and deleted. The
sentence can be limited to 80 characters.

A new sentence can be started by pressing the + key. This should clear the bottom line of the
screen. If we had a speech synthesis function, we would then call it on the string being
displayed!

BE SURE TO DEMONSTRATE YOUR PROGRAM AND GET IT CHECKED OFF BY
YOUR TA. TAs will ask you about the following during the checkoff.
IN YOUR COMMENTS: Describe how you keep track of the word selected and how this
interfaces with the wiimote. Is the interface reasonable? What string errors did you
encounter and debug in this lab?

I am really stuck and don’t know where to begin. Im not asking for someone to do this for me unless they really want to for some reason but I would like help getting through it.

No comments for this entry yet...

Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...