Pisswasser
Anyone have any idea about Comparison and swapping values in Sorting Algorithms?
Anonymous
thx for accepting me
Anonymous
hi guys! Im new at C. Quick question Is there any way to check if user inputs anything else than a number? I tried ISDIGIT but it takes a char as argument and I need the user to input either a float or int. So isdigit isnt't working for me.
Ashish Bhushan
If you need the user to enter either float or int...then why not just simply print a message to do so
Asad
seems like no.
Asad
bullshit. i am talking to myself
Anonymous
Because I'm starting with programming. Either way... Seems like C has no way to check input types
Ashish Bhushan
Yes
Anonymous
hi guys! Im new at C. Quick question Is there any way to check if user inputs anything else than a number? I tried ISDIGIT but it takes a char as argument and I need the user to input either a float or int. So isdigit isnt't working for me.
https://github.com/chandradeepdey/C_inputlib see the get_int(), get_long(), get_unsigned() functions in this. if you decide to use the functions in your code, be sure to change the cust_getline() to getline() because getline() is much faster.
Nils
Hi, how do I get a random number between 0 and 255?
Nils
All the ways are somewhat broken... :-/
Asad
and multiple google results
Asad
All the ways are somewhat broken... :-/
yes. still gets the job done
Nils
yes. still gets the job done
I want to use the numbers for security stuff…
Francisco
std::mt19937 gen{std::random_device{}()}; std::uniform_int_distribution<> dist{0, 256}; dist(gen()); // This returns a random integer between 0 and 256
Nils
I want to use the numbers for security stuff…
And bad randomness in such is fatal
Francisco
what exactly is std::random_device{}()? is it /dev/random which has good randomness?
To make the generator generate "almost random" numbers, you need hardware support. It's more or less the equivalent of srand(time(0));, but in a better way
Anonymous
getchar isdigit ungetc
I need to store the input in float variable. Isdigit needs char argument so it won't do
Francisco
The constructor accepts some parameters to tell the object from where it must take the random seed (like /dev/random)
Francisco
what is wrong with srand() ?
It's C and implementation dependent, you can't control where the randomness is generated
Nils
This a example of bad randomnes, what I get from most examples in C++
Nils
While this is good randomness
Dima
randomness
Nils
what is this?
a "randomly" generated picture
Asad
Francisco
and the way you showed is better?
The std::random_device is just a way to generate "true randomness". The std::mt19937 is a decent pseudo-random number generator, taken an initial seed. The std::uniform_int_distribution is used to generate the numbers following a uniform distribution (there's many distributions to choose from in the STL)
Francisco
And that's why the srand-rand way of generating random numbers is so inconvenient, because you can't really control all the stuff the random in the STL can
Anonymous
Hi guys, hope you're doing great. I need some help with google app engine. I wanted to know if ffmpeg can be used in Google App Engine. Feel free to DM me or message on group. Help will be appreciated. Thank You.
Foxner
Hi. Is there an off-topic group? I'd like to ask a signal processing related question.
Faisal
Hi I'm new.
Dima
Hey new
Dima
where’s delete
klimi
where’s delete
He got purged haha... Gn
Faisal
I am here to enhance my knowledge.
Faisal
Is it right place?
Francisco
@Mtamatz
Sorry guys have a question the similarities of structure and union are impeccable, but still the two can not be concluded to be the same. justify using clear C programs code for each showing structure differences.  Help me plz how can answer that question 👆
Anonymous
Guys Could anyone tell me why this keeps failing? I get a infinite loop :S
Anonymous
everytime I input anything besides a number like a char the infinite loop starts
Dont
Guys Could anyone tell me why this keeps failing? I get a infinite loop :S
Add this before the second scan : while(getchar() != '\n') continue; It is the best i've found to solve your problem
Anonymous
Add this before the second scan : while(getchar() != '\n') continue; It is the best i've found to solve your problem
Would you please clarify why does the infinite loop happen and how adding that line solves the problem? im starting with C
Anonymous
thx!
nav
What are some situations when C/C++ is more appropriate than python, since python is easier to program in?
Dk
Hi there me Dinesh just now completed schooling where looking to do engineering ECE. so doing this can I work for a software engineer? Plz help me
Faisal
Can Anyone can tell about vscode debugging? I'm getting debug out on cmd window not on terminal of vscode How to resolve it
Anonymous
Why not?
Have you used it? If so then do tell me
Anonymous
Guys Could anyone tell me why this keeps failing? I get a infinite loop :S
while (scanf("%f", &num) < 1) { scanf("%*[^\n]"); ... }
Anonymous
Anonymous
Use QT
Valentyn
WTF
Valentyn
it was just a link to my github repository 😓
Valentyn
Hi there, I want to implement some "OOP" style in my C code. Could you give some constructive criticism of my code.
Valentyn
Valentyn
Is there at least some opportunity to send links?
Valentyn
_____github.com/Neboron/SimpleFB
Suleyman
char* reverse_word(char *arr){ int i,c,k,length,temp; length=strlen(arr)-1; k=length; for (i=0; i<length/2 ;i++){ temp =arr[k]; arr[k]= arr[i]; arr[i]= temp; k--; if(k == (length / 2)) break; } return arr; }