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

I AM A DUMB OLD DOG HELP

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 14
Thread images: 5

File: 24157_348447133991_4093927_n.jpg (44KB, 720x478px) Image search: [Google]
24157_348447133991_4093927_n.jpg
44KB, 720x478px
So I'm working in C langauge with a GNU compiler. I'm trying to make it so that when the user puts in any values not between 0 and 3 it will enter a while loop and print an error. Whenever I run this line the program crashes


while ((dice<0) && (dice>3)){
printf("Error, you can only roll 0 through 3 dice!\n");
scanf("%d",dice);
}
>>
File: 1474511934967.gif (2MB, 300x300px) Image search: [Google]
1474511934967.gif
2MB, 300x300px
pls help
>>
>>57224926

> while dice is less than 0 and greater than 3

Man I hope this is bait..
>>
>less than 0 AND greater than 3
Maybe read through your code sometimes?
>>
>>57225077
>>57225068
oh shit, how does I or?
>>
>>57224926
int dice;
do {
printf("How many dice to roll (0-3)?\n");
scanf("%d", &dice);
} while (dice < 0 | dice > 3);
>>
File: mQIhFt1.jpg (14KB, 250x238px) Image search: [Google]
mQIhFt1.jpg
14KB, 250x238px
>>57225100
>>
>>57225100
|| or OR should work, but start with the straight lines
>>
File: 1461559806773.jpg (24KB, 297x303px) Image search: [Google]
1461559806773.jpg
24KB, 297x303px
>>57225100
wut
>>
>>57225100

yes the or comparison operator is two uppercase I's
>>
File: 1457650034578.jpg (648KB, 1024x1145px) Image search: [Google]
1457650034578.jpg
648KB, 1024x1145px
thanks guys, I realized I made it an and statement and it needs to be an or-- works now.
>>
>>57225120
>inb4 II doesn't work
>>
>>57225133
>>57225296
Don't be mean
>>
>>57225494

eat shit and die
Thread posts: 14
Thread images: 5


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.