hey all, im a newfag at programming and im taking a year one programming course at the university, (im year 3 maths) and i need sone help i have no idea wtf to do and my teacher speaks borderline english.
i need to make this program below using call by referance instead of call by value, i have no idea how to do this, so if anone could get me started,,, or anything i would really appriciate it =)
/* (1). extend your program for n washers instead of 4 */
/* (2). coffee */
/* (3). I hope you get the point(er), get it? */
int main(void)
{
double washer1 = 'A', washer2 = 'B', washer3 = 'C', washer4 = 'D'; /* aw what the fuck */
int q1, q2, q3, q4;
double t1, t2, t3, t4;
double d1, d2, d3, d4;
double dA1, dA2, dB1, dB2, dC1, dC2, dD1, dD2;
double pi = 3.14159265; /* double pi = M_PI; */
>>1
Good evening gentlemen. I'm a beginner at the art of programming and I'm having a programming course at the university I'm attending. I have 3 years of experience in the art of mathematics and therefore, I, the wizards apprentice, ash Thou for your help with arcane magic. For that sake, I have no clue on mixing the ingredients for achieving a high quality potion. My dear wizard beholds a curse of partial REGULAR EXPRESSIONS.
I need to write a scroll, as it is seen below, using the spells of call by reference instead of scrolls of call by value. I therefore urge you to help me, a brother of your kind. If any of you master wizards could point me a direction to the source of my error, or similar, I would appreciate it and express it with glee.
>>7
The funny part is that int main(void) and int main(int argc, char *argv[]) were standardized more than 20 years ago.
Name:
Anonymous2010-11-04 4:21
>>6
My good sir, I must commend you for your majestic use of words. It was a splendid display of using your intellect to get your point across. If only the poser who originally stared this thread had posed his question with equal splendor, the masters here surely would have shared their knowledge of the arts.
/* 1: extend your program for n washers (partial done, needs more args rather than macro) */
/* 2: coffee, chewing gum */
/* 3: the anwser is &(*ptr) = ptr */
/* 4: extensions up in this magic scroll */
int main(void)
{
auto signed int i, limit, q[N_STAR]; /* i = iterator, limit = amount of washers, q = quantity */
auto double tau[N_STAR], rho[star]; /* tau = thickness, rho = density; all in arrays */
auto double inner_d[N_STAR], outer_d[N_STAR]; /* inner_d(iameter), outer_d(iameter); all in arrays */
auto double sum_w = 0, weight[N_STAR] = {0}; /* sum_w = sum of the weights & individual weights in array */
printf("%s%s","please enter the amount of","washers: ");
scanf("%i",&limit); putc('\n');
if (limit <= 0) {
for (i = 0; i < limit && limit < N_STAR; ++i) {
printf("%s %s, %s %s, %s %s, %s, %s, %s (%s): ",
"please enter the","quantity","thickness","(tau)","density","(rho)",
"inner diameter","outer diameter","of washer","data must be spaced");
scanf("%d %lf %lf %lf %lf",&q[i],&(*(tau+i)),rho+i,inner_d+i,outer_d+i);
cur_weight = washer_weight(&q[i],&(*(tau+i)),rho+i,inner_d+i,outer_d+i);
weight[i] = cur_weight;
sum_w += cur_weight;
putc('\n');
}
} else {
printf("%s: %i\n","the amount of washers is not a valid; size");
return 1;
}
printf("washer type \t quantity \t thickness \t desity \t weight \n","",,,);
for (i = 0; i < limit && limit < N_STAR; ++i)
print_weight(*i, q+i, tau+i, rho+i, weight+i);
printf("********************************************** \t %0.2f \n", total_weight);
This scroll might include side-effects and/or random morphing when used. Take care.
>>11, 15
We shall see you as an object that is utterly useless and does not belong in the library of /magic/. You will not catch us with your lies, because we are not fish.
>>5
YHBT. M_PI is not defined in math.h. Actually it's not defined anywhere in standard. All your life was a lie. If kid is compiling his shit with ms troll stduio, he will be fucked. But then. I'm okay with it.
>>18
He did, with -O1. Unfortunately -O1 is of course typically only acceptable for beta testing, and the /prog/ standard for point-release posts is gbbcc -O3 -D_GNAA_SOURCE -D_IVE_READ_SICP -faggot-quotes -fno-exceptions.