# tables...

Show 80 post(s) from this thread on one page
Page 1 of 2 12 Last
• 10-16-2006
peanut
tables...
Code:

```#include <stdio.h> #include <math.h> int main(void) { double volts, init, ending, increment;     fputs("What is the voltage?", stdout);       scanf("%lf", &volts);     fputs("What is the initial resistance?", stdout);       scanf("%lf", &init);     fputs("What is the ending resistance?", stdout);       scanf("%lf", &ending);     fputs("What is the increment resistance?", stdout);       scanf("%lf", &increment); /*Up till now i think i did it right... but i have no idea how to make this a table.  it makes it hard to know how to display the results...*/ return 0; }```
my assignment is hosted online at

http://cs.clark.edu/~cowen/CSE121/As...ignment.2.html

I would really appreciate any help on how to make a table... any help at all. thanks.
• 10-16-2006
fnoyan
• 10-16-2006
Quote:

i.e. the table should show the voltage, total resistance and current.
a table (in this case) isnt programming-specific.. its a 'table'.. a 'chart'. a method of displaying data. ill try to do it in pseudocode as well:

Code:

```print "voltage" print tab character print "total resistance" print tab character print "current" print newline character for resistance = initial, ending, increment     compute inductance     print (computed voltage value) + "V"     print tab character     print (computed resistance value) + "Ohm"     print tab character     print (computed current value) + "I"     print newline character end for resistance print "voltage" print tab character print "total resistance" print tab character print "current" print newline character```
of course if you dont know how to display the tab and newline characters do a simple websearch and youll find it. hope this helps.
• 10-16-2006
peanut
um...
I don't want you to do my homework for me at all... i simply don't know how to make my data be displayed in a table... thats only a small concept within my homework. My instructor has no problem with me getting help online either. i'm really sorry if i misjudged the scale of what i'm asking... i don't know how to make it a table... consequently i don't know how hard it is.

I put my homework link up not because i want my homework done for me... but because it's easier to show what i need. i'm not the best at "c programming talk" and i don't really know how to communicate my problem.

All i would like help with is how to display it in a table... not the equation or anything else in this assignment.

I'm really sorry if i misjudged the scale of this question... but how do i know? If it's really complicated i would also appreciate a nudge in the right direction. thanks alot for listening.
• 10-16-2006
peanut
• 10-16-2006
Quote:

don't want you to do my homework for me at all... i simply don't know how to make my data be displayed in a table.
i completely understand you i didnt think you were asking for someone to do it. you gave an effort you werent just asking for someone to do it for you. hopefully i didnt give you the answer but made it more clear.

im sure fnoyan has heard questions like this all the time on this forum and its probably very often 'can you do my homework for me?' and he assumed it was a similar question, which is understandable as hes been here afew years and has heard it before often. ive only been here for afew days, however if you were asking us to DO it (all) for you i wouldnt have replied.

good luck
• 10-16-2006
peanut
this is kinda confusing... are you just spacing it out into a chart?
• 10-16-2006
peanut
hehe, i'm not exactly sure what pseudocode is... but i think my table is supposed to look like his example... It's at the bottom of this link... i don't think he wants me to just /t the right amount of times... even though that is a chart.

http://cs.clark.edu/~cowen/CSE121/As...ignment.2.html
• 10-16-2006
peanut
does anyone know anything that can help me?

i really need it and i appreciate it.
• 10-16-2006
pseudcode is basically using english phrases to show the logic and operations in place of programming syntax... ie, there isnt a function (as i referred to it above) called 'print'. its simply using english to layout what is required. YOU must translate this to C code.

and unless you have done GUI work, then yes this is most likely what he wants. to have spacings as i layed out above. i guess, after looking at the link you supplied, my table headings werent correct but you can substitute them.

sorry for the late reply, i just joined this board and it doesnt seem to always email when someone replies to a thread im subscribed to.

Quote:

this is kinda confusing... are you just spacing it out into a chart?
yes. theres nothing any more advanced to what he wants.

break the problem to smaller parts. first print the table headings as nicely as you can, post that code then we'll continue.
• 10-16-2006
whiteflags
> I would really appreciate any help on how to make a table...
Excuse me for interrupting, but If you're willing to study a bit just format your output with printf()
• 10-16-2006
that will be useful for the certain number of decimal places, but im trying to help him just get the layout and 'table' printed before worrying about the date inside it
• 10-16-2006
whiteflags
That doesn't seem to make sense. If he wants to just print out all the data neatly using whitespace then printf() can do all the work.
• 10-16-2006
i know it can. he (seemingly) doesnt know what escape characters are yet, so i didnt give him full solutions. im trying to push him along, ie:

peanut: try and get the program to do this (again this is more pseudocode):

print "Case" + tab + "Voltage" + tab + "Initial Resistance" + tab + "Ending Resistance" + tab + "Increment Resistance" + newline
print "1" + tab + "5" + tab + "1.001" + tab + "1.010" + tab + ".001" + newline

just do this in a new file, dont worry about other variables or loops, just print this output then end.
• 10-17-2006
peanut
Code:

```#include <stdio.h> #include <math.h> int main(void) { double volts, init, ending, increment;     fputs("What is the voltage?", stdout);       scanf("%lf", &volts);     fputs("What is the initial resistance?", stdout);       scanf("%lf", &init);     fputs("What is the ending resistance?", stdout);       scanf("%lf", &ending);     fputs("What is the increment resistance?", stdout);       scanf("%lf", &increment);     printf("case\t"  "voltage\t"  "Initial Resistance\t"  "Ending resistance\t"  "Increment Resistance\n"           "1  \t"  "5      \t"  "1.001            \t"  "1.010            \t"  ".001                \n"); return 0; }```
kinda like this? i added spaces after the numbers so that they'd line up. i guess that's a big chunk outa my assignment... but now i need to figure out what equations i'm supposed to implement for the variables that i'm ignoring...
Show 80 post(s) from this thread on one page
Page 1 of 2 12 Last