GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 02-Nov-2009, 20:41
d0ll3rb1ll d0ll3rb1ll is offline
New Member
 
Join Date: Nov 2009
Posts: 6
d0ll3rb1ll is on a distinguished road

Multiplication table in C lang. using loops


As stated I need to write a program that asks for a positive number and keeps asking until its gets one then it outputs the results. The results need to be outputted like below. Thanks. The asterisks are suppose to be spaces.

**1 2 3
1 1 2 3
2 2 4 6
3 3 6 9
  #2  
Old 02-Nov-2009, 22:59
d0ll3rb1ll d0ll3rb1ll is offline
New Member
 
Join Date: Nov 2009
Posts: 6
d0ll3rb1ll is on a distinguished road

Re: Need help with mult. table in c lang. using loops


I don't know how to start writing the code so if anyone could give me some hints, pointers ect.
  #3  
Old 02-Nov-2009, 23:47
Howard_L Howard_L is offline
Regular Member
 
Join Date: Apr 2007
Location: Maryland/PA, USA
Posts: 802
Howard_L is a jewel in the roughHoward_L is a jewel in the roughHoward_L is a jewel in the rough

Re: Need help with mult. table in c lang. using loops


Dude, you must have a C book of some sort.
If not this tutorial by MR.K himself has everything you'll need to know for now:
http://lysator.liu.se/c/bwk-tutor.html ...It's up to you to do the reading.
So write something and try it and post us back with problems you're having.
(and include the code you're having trouble with when you do.)
  #4  
Old 04-Nov-2009, 07:27
Mexican Bob's Avatar
Mexican Bob Mexican Bob is offline
Member
 
Join Date: Mar 2008
Location: Chicxulub, Yucatán
Posts: 226
Mexican Bob is a jewel in the roughMexican Bob is a jewel in the roughMexican Bob is a jewel in the rough

Re: Need help with mult. table in c lang. using loops


Quote:
Originally Posted by d0ll3rb1ll
As stated I need to write a program that asks for a positive number and keeps asking until its gets one then it outputs the results. The results need to be outputted like below. Thanks. The asterisks are suppose to be spaces.

**1 2 3
1 1 2 3
2 2 4 6
3 3 6 9

Do you even read what you write? If we decode your post "Title" you are asking for help with a multiplication table using C and loops, right?

How is "asks for a positive number and keeps asking until it gets one then it outputs the results" and the "results need to be outputted like below" have anything to do in common? The "output" that you wrote is, assumedly, the "multiplication table."

Where is the "positive number" and how does it relate to the results as you've shown?

Are you aware that 19281.1121847 is a positive number? Not "the number" that you wanted? Perhaps you ought to start by calling things by what they are with respect to what you want? If you want a positive integer, say so.

So, what should the output be if the user enters 928473? Isn't that a positive integer? What if the user enters 123456789123456789? Isn't that also a positive integer? How big is your table supposed to be? 3x3 as is somewhat maybe kinda sorta indicated by your "output?"

Maybe if you spent two whole minutes rather than just blurting out regurgitated crapola, we would understand what it is that you want/need help on.

Don't take this the wrong way, but we need you to help us help you. If your "request for help" creates more questions about what it is that you want, then you're killing us! We're here to help you. That's why we participate on this forum.

If I walked into a store and told them that I wanted to buy a box, would I be giving you enough information to figure out what kind of store, what kind of box, what material the box was made of, what might be contained or containable by the box or any where nearly enough information for you to do any real "processing" of the content that I spewed forth? If I happened to be in a store that sold shipping crates for live animals, would you know if I was shipping a pootle or a grizzly bear?

Start by looking at an inanimate object next to you, such as a book. Explain to the book what it is that you want help with. I'm sure that the book will not argue much with you about the way you worded it, but by going through the process, you will have at least "practiced" telling your story at least once.

Then, type it down in the forum. Then (extremely important) click the Preview Post button and REVIEW your work. Re-read it. Try to assume that you have no idea what you want or were trying to tell others and just see if you can understand what it is that is desired from the content that you're about to submit to those of us who actually don't know what it is that you want.

Does the title adequately summarize or otherwise "frame" or "set up" your request?

If you can't do this simple thing for a rather intuitive group of very experienced and intelligent humans, you will never be able to do it for a totally stupid box of electronics whose rules are incredibly demanding and every single little error that you make will be dramatically amplified or secretly hidden in the bowels of the beast...waiting for the most inopportune time to blow up in your face.

The computer will do only what you program it to do. Consider your program to be a set of absolute instructions. You can't ask the computer to interpret your messages.

Get a number from the user:

What is the definition of "a number?"

You need to start thinking in terms of the kinds of data that it understands and how those kinds of data can be used to represent problems that you want to solve using the computer and your programs.

If the problem is to represent a multiplication table and to have the user enter some numerical value that corresponds to some row and column such that the result is the coordinate value contained at that location...OR if you simply want the user to enter some number between 1 and 3 and arrive at both a printed multiplication table and some "result" then you really have a LOT more explaining to do.

Unlike the computer, people can ask lots of questions. Usually, the computer won't tell you very much and the designers of compilers tend to intentionally respond using cryptic messages that are reflective of the true inner-workings of their particular designed product and its implementation of the rules of the language as they've interpreted them.

Other times, the compiler will silently accept everything that you tell it to do and produce the biggest load of crap you could possibly imagine simply because you told it to without intending to. Somewhere between that and programming excellence, you're going to have to work on how you "explain the problem" to other humans and to computers. Between now and then, you're likely to get a lot of dumb stares and loads of crap from the computer.


MxB
 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the pixels' value of a bmp image? (Pelles C) Soundzz C++ Forum 51 29-Jun-2009 08:53
2D arrays:dynamic allocation and freeing bravetanveer C Programming Language 48 27-Nov-2007 16:55
Transfer longblob from one table to another table Richardknox MySQL / PHP Forum 6 13-Dec-2006 05:26
Cannot create a table in DB WaltP MySQL / PHP Forum 3 26-Apr-2006 17:09
No output from loop function crystalattice C++ Forum 2 20-Dec-2004 21:39

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 13:52.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.