Anonymous
Sorry numpy
_VVV_
Anonymous
Ion know what dat is fam
Anonymous
Anonymous
void printNumbers(){
int i;
for(i =0;i < 5; i++)
{cout << “Numbers :” << i<< endl;}
}
Please how do I pass this void function to my c++ main function?
The_Sea
Alright
Thanks
Ok
From where can I start
Anonymous
artemetra 🇺🇦
The_Sea
Anonymous
Do you main in struct?
Not really
I’m just a member here also , learning but I can assist if you want
Anonymous
The_Sea
Anonymous
Nisso
Hi gus
Nisso
I need some help on rpcgen with c language
Nisso
Pleaz,I already generate the files and my prog work good i need to add another function in my file.x if i need to generate again another files its return message error,your help going be good for me,thanks
Nisso
🙏🙏🙏🙏
Sid
I just want to learn how to calculate auxiliary space and space complexity
Sid
Someone plz share some resources
Talula
Yui
BigO?
Anonymous
Hello, does there have any cpp open project about config parser that supports JSON and YAML? If that could support struct member mapping is better.
Sketchyyy
#include <iostream>
#define ULI unsigned long int
ULI fact(ULI value){
if(value < 2){
return 1;
}
return value * fact(value-1);
}
double check(ULI value){
return ((fact(value-1)+1)/value);
}
int main(){
int value = 9;
double x = (fact(value-1)+1)/value;
std::cout << (fact(value-1)+1)/value << "\n"; // why not in decimals?
std::cout <<x; // why not it decimals?
}
Sketchyyy
Why is the result not in decimal points?
klimi
klimi
value-1 => int
fact() => return int
fact() + 1 => int
()/value => none is floating point so whole number division => int
Sketchyyy
Sketchyyy
klimi
and then the last step is to convert it to double and store it in x
Sketchyyy
Sketchyyy
klimi
you are doing it
klimi
double x = number;
klimi
it is implicitly converted from int to double
klimi
if you want fixed double number in the std::cout see this https://stackoverflow.com/questions/5907031/printing-the-correct-number-of-decimal-points-with-cout
But your calculation is not made as floating point arithmetic (so just storing it in double doesn't make much sense)
Sketchyyy
klimi
klimi
and since it is all zeroes, std::cout probably doesn't print it
Sketchyyy
40321/9 != 4480.00..00
klimi
Sketchyyy
klimi
you are making whole number division
klimi
if you want to do floating point arithmetic you need to use double or float
Sketchyyy
Sketchyyy
So that they'll do floating pt. arithmetic and give me decimal points?
klimi
double x = static_cast<double>(fact(value-1)+1)/value;
klimi
so you want to have this?
klimi
btw, if you have used some additional tools like is clang-tidy, it would produce an warning like this:
[clang-tidy] Result of integer division used in a floating point context; possible loss of precision (13:12)
klimi
really handy
Sketchyyy
klimi
(you have the same problem in your check function)
Sketchyyy
Thank you dude
klimi
No problem
Sketchyyy
#include <iostream>
double fact(double value){
if(value < 2){
return 1;
}
return value * fact(value-1);
}
double check(double value){
return ((fact(value-1)+1)/value);
}
int main(){
int value = 9;
double x = (fact(value-1)+1)/value;
std::cout << (fact(value-1)+1)/value << "\n"; // why not in decimals?
std::cout <<x; // why not it decimals?
}
Sketchyyy
Sketchyyy
klimi
Not sure how much precise it will be calculating the factorial but for small numbers it should work fine
Anonymous
Dear all do you knw how to create a event management in visual studio in c++
Anonymous
??
neovstan
neovstan
Tend to don’t use preprocessor
Sketchyyy
aslam
Hi,
I have a C++ code given to me by one of my colleagues and it has this statement
#define __USE_MINGW_ANSI_STDIO 0
What does it mean?
I understand that 0 disables it but what is its function when enabled to 1?
Talula
aslam
What is MINGW_ANSI_STDIO though?
Anonymous
Talula
What is MINGW_ANSI_STDIO though?
From what I just read now, it seems like it is telling the compiler to use either MINGW printf output system or Microsoft printf system...
But I could be wrong.
Krishan
Is there anyone who can guide me with c++ programming
Krishan
I'm a beginner so I need one
Anonymous
Krishan
/
help
/
someone know what is mbedtls
/
it have functions like mbedtls_cipher_setkey