[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Im working on a project for a class, and cant, for the love of
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 14
Thread images: 2
File: untitled.png (236 KB, 258x600) Image search: [Google]
untitled.png
236 KB, 258x600
Im working on a project for a class, and cant, for the love of Yoda, figure out why i'm timing out. Please give it a go.
>>
Here is the code .
#include <stdio.h>
int main(void)
{
/*Define variables*/
char famName;
char NDB[5][10];
char famState;
char SDB[5][10];
int famAge;
int ADB[10];
int i;
int count;
int sum;
float average;
/*set initial values*/
i = 1;
count = 0;
sum = 0;
/*Run for loop to cycle through each family member*/
printf("Enter a family member’s name, two digit state they reside in, and age: \n");
for (i = 0; i < 2; i++)
{
/*Input Name, State, and Age*/
scanf("%s", &NDB[count]);
scanf("%s", &SDB[count]);
scanf("%d", &ADB[count]);
/*Set values equal to array*/
//NDB[count] = famName;
//SDB[count] = famState;
//ADB[count] = famAge;

count = count +1;
}

/*Print Results*/

for(i = 0; i<count; i++)

{
printf("%s \n", NDB[i]);
printf("%s \n", SDB[i]);
printf("%d \n", ADB[i]);
sum += ADB[i];
}
average = sum/(count);

{ if (" famState == TX "){
printf(" %s lives in Texas.");
}
else {
printf(" There are no family members in the lone star state. ");
}
}
printf(" The average age of the family is %f.", average);
return 0;
}
>>
>>51823064
count = count +1;
}

/*Print Results*/

for(i = 0; i<count; i++)

1 !< 1
>>
Where did I miss that ?
>>
It should be a bannable offense to post pics of women solely to make your thread get attention.
>>
lol, I'm sorry, I could post the whole folder if ya want. Its part of my background rotation.
>>
There is so much wrong here...

The more I fixed it, the more I realized your just trolling here.
> no strcmps
> doing comparisons on vals which are never assigned
> using multidimensional arrays incorrectly
and more bs trolling..
>>
I'm really not trolling, mate. The code is all good until I get to the part about printing the inputs from TX. The IF ELSE statement is buggy somewhere, and it has been kicking my ass for a couple of days now. The project is due tomorrow.
>>
>>51823416
Man its been a whiiiiile since i touched pure C, lovely language by the way quiet, demure and does what you tell her. Unlike her bitch of a sister c++...ahem anyway..

I am pretty if i remember correctly that you still kinda have to do something like &NDB[stuff][extra stuff] to mess with a multi array.
&NDB[stuff] would work for a single array, for a multi one you have to specify each place aka
&Crap[1][0] that looks at the second row first collumn(just in case remember pc's start counting from 0)
So what you did kinda causes the compiler to go "wtf man?! This is a multi array! Ok look at x row but collumn?"

Anyway, review multi arrays, the rest of the errors are left as an exercise to the rea-faggits
>>
>>51823064
Who is semen demon?
>>
>>51825790
Some crossdressing faggot named Kato.
https://www.google.com/search?q=kato+steampunk+-site:pinterest.com&tbm=isch&imgil=6IWWOWkDRuNQXM%253A%253BRvI8BdXuAEiuUM%253Bhttp%25253A%25252F%25252Fweheartit.com%25252Fentry%25252Fgroup%25252F2478484&source=iu&pf=m&tbs=simg:CAESjAEaiQELEKjU2AQaAggKDAsQsIynCBpiCmAIAxIolRKMEIwHnxrgGocQ4RqcB44HpR3MI5cx4zC7INg7qjLPI_1ojsjKYMRow-v9hcdm_1_1eHVvrEkrUCJNijAeDhJ470YEGutg4hUON5dlMTXafMx8-SsjigqbuPpIAMMCxCOrv4IGgoKCAgBEgQ4XHJkDA&fir=6IWWOWkDRuNQXM%253A%252CRvI8BdXuAEiuUM%252C_&biw=954&bih=975&usg=__eUoxwUpvcgir0wFSoCirkZ0t9b4%3D&ved=0ahUKEwj_pY77hNfJAhVGOiYKHYrBD3sQyjcITg&ei=G3NsVr-sE8b0mAGKg7_YBw#tbm=isch&q=kato+steampunk&imgrc=_
>>
>>51825843
>crossdressing faggot
Oh the irony
>>
File: Untitled.jpg (18 KB, 416x154) Image search: [Google]
Untitled.jpg
18 KB, 416x154
>>51825790
It's so easy dude stop asking so much.
>>
>>51823416
Learn how to use a debugger. For this Mickey Mouse program, you ought to be able to debug it in 30 minutes or less.

Watch all of the variables of note as you step through the loops.
Thread replies: 14
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.