Anonymous
Intel runs a mo
Marie
There are no blacklisted messages here!
Anonymous
just use ponyos nothing can go wrong at all
"Thanks, but no Thanks"
Anonymous
Intel runs a mo
Mao spOywers ?
Anonymous
What is the preferred IDE for C? I've been using visual studio for now but opinions would be nice! :)
vscode is pretty much the best available option unless you have bleeding edge distro and could install the latest gnome builder so it would be better option ig spacevim is nice thing to try (imho)
Marie
Purge complete.
Alignant
The best linux distro is
Alignant
Ponyos ^.^
Roxifλsz 🇱🇹
The best linux distro is
Linux distro discussion belongs on OT
Roxifλsz 🇱🇹
Ponyos ^.^
And this isn't even linux
Roxifλsz 🇱🇹
If you're going to be shitposting, please do it correctly
Anonymous
anyone ever tried resharper c++?
bdam
hi guys
bdam
I wrote a simple program inspired by an exercise from the C book (ritchie and Kernighan)
bdam
I have a weird bug and I can't fix it
bdam
could someone take a look at the 10 lines of code and help me out pls?
Roxifλsz 🇱🇹
could someone take a look at the 10 lines of code and help me out pls?
How about posting the code first, nobody can help you without that
klimi
Just add semicolon
klimi
I hope my crystal ball is working ok
Ariana
Isn’t bug like unexpected behaviour?
Dima
Imagine how much of undefined behaviours you can fit into 10 lines
Dima
especially in cxx
bdam
How about posting the code first, nobody can help you without that
Oh sorry, I didn't know that it's allowed to post code in the group here (wanted to send it per pm)
bdam
Give me 30 min, not at work rn
Mat
If it is, use a paste site like the one in the pinned message
bdam
Ok great, thx
bdam
#include <stdio.h> /*for every input by the user, the boolean value of c is determined and printed out*/ main() { int c; c = 1; while((c = getchar()) != EOF) { c = getchar() != EOF; printf("%d\n",c); } }
bdam
When I compiled & ran I noticed weird behavior
Dima
wtf
bdam
for example, when the input is:
bdam
ssssssssssssss
bdam
I get in return:
bdam
1 1 1 1 1 1 1
bdam
so 14x s and 7x 1
bdam
why is it not 14x 1?
Dima
use getchar once
bdam
oh, it's tokenized?
bdam
e.g it takes every second input cause I used getchar twice?
bdam
Thank you guys. and now I feel dumb again lmao
Mdex Community
Anonymous
Hi, working on a small program that takes 3 numbers and returns the average. The online judge I use requests that I have 2 decimal places. Not sure what I am doing wrong here.
Anonymous
#include <iostream> #include <iomanip> int main(){ int a,b,c; double by = 3; std::cin>>a>>b>>c; std::cout<<std::setprecision(2)<<(a+b+c)/by; return 0; }
Anonymous
I Googled, found out about setprecision, yet something is off and not sure what.
Anonymous
For 9 8 7...it returns 8 instead of 8.00
Anonymous
Also tried:
Anonymous
#include <iostream> #include <iomanip> int main(){ int a,b,c; std::cin>>a>>b>>c; std::cout<<std::setprecision(2)<<float(a+b+c)/float(3); return 0; }
Alignant
std::cout << std::setprecision(2) << std::fixed << (a+b+c)/by;
Alignant
Try add std::fixed
Anonymous
That works @Alignant TY!
Anonymous
Need to read more on std::fixed
Anonymous
http://www.cplusplus.com/reference/ios/fixed/
Anonymous
Is this an ok site for reading documentation or should I be using something else?
Alignant
And you shouldn't devide ints by doubles, it's confusing. And there's nothing to read about it. std::setprecision doesn't enforce your number to have 2 digits after the dot
Anonymous
So I should declare numbers a,b,c as floats or?
Alignant
double a = 10, b = 3; std::cout << std::setprecision(3) << a/b << std::endl; That would print 3.33. But double a = 10, b = 3; std::cout << std::setprecision(3) << a/b << std::endl; But it would just print 3. setprecision sets the max precision
olli
Is this an ok site for reading documentation or should I be using something else?
You can also read about the formatting of floating-point values here https://en.cppreference.com/w/cpp/io/manip/fixed or here http://www.cplusplus.com/reference/ios/fixed/
Anonymous
ty ty!
Anonymous
and even if you wanted to do that check, you're calling getchar twice
Alignant
lol c is a result of boolean expression
Yap, could've made it a bool
Anonymous
doesn't make any sense either
Anonymous
he is calling getchar() twice
Anonymous
already did that check
Alignant
This problem is already solved
Anonymous
salve a tutti, spero di non sbagliare nel fare qui una richiesta flin4cell per win10
Bobby_ke
#include <iostream> #include <iomanip> int main(){ int a,b,c; double by = 3; std::cin>>a>>b>>c; std::cout<<std::setprecision(2)<<(a+b+c)/by; return 0; }
#include <iostream> using namespace std; int main() { int a,b,c; double average; cout<<”input three numbers"<<endl; cin>>a>>b>>c; average=(a+b+c)/3; cout<<"avarage ="<<avarage; return 0; }
Roxifλsz 🇱🇹
Marie
salve a tutti, spero di non sbagliare nel fare qui una richiesta flin4cell per win10
Pierfrancesco has 1/3 warnings... watch out! Reason for last warn: non english
Marie
salve a tutti, spero di non sbagliare nel fare qui una richiesta flin4cell per win10
Pierfrancesco has 2/3 warnings... watch out! Reason for last warn: italian