![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
Help with simple math table program (was a SIMPLE program) Hi,I started C programming 3 weeks ago, we had three four hour lessons, I am amazed how some people lack teaching skills or have any concern for students who like myself have other subjects to study for. I am not dumb and I normally pick up things quickly but I must say that I have learned more from internet then what I have picked up in the class. OK, ok, I just had to let a little bit of hot air out, it's all because of his poor teaching techniques! I need someone to help me with this problem, I would prefer if someone gave me every second line so that I can work out anything in between! I was given this: CPP / C++ / C Code:
Write a program to modify the "tables" program, so that it prints out a table appropriate to an operator entered from the keyboard by the user. The program must be menu-driven and accept t, %, -, *, / , as inputs. The table must stay on the monitor screen until the user strikes a key and when upon control is passed back to the menu. To exit, the user must enter "Q". It's as simple as that, can anyone help? Bubba Last edited by LuciWiz : 08-Mar-2005 at 07:31.
Reason: Please insert your C code between [c] & [/c] tags
|
|
#2
|
||||
|
||||
|
Start a while() loop that exits when "input" is 'Q'
Display your menu, accept the character. In a switch() block, test the character and process it accordingly That's about as much as I can tell you since I have no idea what 't' and '%' would do. Also, read the note from LuciWiz at the bottom of your post. __________________
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough. -- Pearl Williams |
|
#3
|
|||
|
|||
|
I assume "t" stands for "to be displayed on one line and "%" some mathematical function. Sorry guys I'm still beating my head against the wall as for what has to be placed where! Are you saying to continue with while () loop just above the "return ()" and then continue with the switch () block?
Sorry I feel we are nowhere near the stage to be able to write something like this! I'm still having problems with getting use to jargon and terms which we barely touched in the class. Anyhow I know I'll get there one way or other, certainly not with his mechanical approach. I'd like to hit him with same approach or see someone do that to him just to see how smart he is! LuciWiz, what does this mean? "Please insert your C code between CPP / C++ / C Code:
I thought it was in the C & C++ forum? :-x Bubba |
|
#4
|
|||
|
|||
|
Quote:
I would assume that you mis-copied the assignment, and that it should be '+', not 't'. Then the assigment seems to be to make a program that lets the user enter an operator: +, %, -, *, or /. Then create a table like the one in the example. Did you compile and run the example? It shows a table with each table entry equal to i*j, where i is the row and j is the column, and i and j go from ... to ... (you figure it out or print it out). Your assignment seems to be to create a table where each table entry is obtained by integer arithmetic and is either i+j, or i%j or i-j or i*j or i/j, depending on user input. Then continue asking the user to enter the desired operator, and print the table for that operation, until the user enters 'Q'. Perhaps one of the points of the exercise is to let you see how the operators work. If you don't understand integer division, or integer modulus, look at your output (or read the text). Oh, yeah, about the code tags (lots of people don't understand at first). Before the first line of your code, put [ c ] (don't put any spaces between the brackets and the 'c'). After the last line of your code, put [ /c ] (without any spaces). Use the "Preview Post" button before you submit the reply, and you will see the code with C syntax highlighted. This helps everyone see a little more clearly what the heck the code is. (It's also prettier.) Regards, Dave |
Recent GIDBlog
Python ebook by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [TUTORIAL] Calling an external program in C (Linux) | dsmith | C Programming Language | 4 | 22-Apr-2005 14:30 |
| simple graphics program on linux | nkhambal | C Programming Language | 2 | 09-Mar-2005 13:57 |
| Help with a simple program | matthewbarr | C Programming Language | 3 | 10-Feb-2005 11:08 |
| Help with a simple program. | bluedragon27 | C Programming Language | 1 | 16-Nov-2004 16:40 |
| How to write simple program like ........? | laputa9000 | C++ Forum | 3 | 29-Oct-2003 13:09 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The