Etaoin
in my case I am maintaining some tree-structured data structure
Etaoin
so pointers must be used
Ludovic 'Archivist'
so pointers must be used
I meant in that main
Ludovic 'Archivist'
Why would you get an address if you can just handle it with less error prone references?
Ludovic 'Archivist'
in my case I am maintaining some tree-structured data structure
So you want to calculates statistics upon a tree of statistics aware containers right?
Etaoin
that statistics is only an simplier example
Ludovic 'Archivist'
that statistics is only an simplier example
Yeah, I am trying to get the big picture
Etaoin
what I want to do is http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.87.9754&rep=rep1&type=pdf and I don't recommend any of you to read this
Ludovic 'Archivist'
It is like a manual of impractical solutions to solved problems 😅
Anonymous
#include "gmp.h" #include <stdio.h> #include <stdlib.h> #include <assert.h> void fact(int n){ int i; mpz_t p; mpz_init_set_ui(p,1); for (i=1; i <= n ; ++i){ mpz_mul_ui(p,p,i); } printf ("%d! = ", n); mpz_out_str(stdout,10,p); mpz_clear(p); } int main(int argc, char * argv[]){ int n; if (argc <= 1){ printf ("Usage: %s <number> \n", argv[0]); return 2; } n = atoi(argv[1]); assert( n >= 0); fact(n); return 1; }
Anonymous
Does this works?
Anonymous
#include "gmp.h" #include <stdio.h> #include <stdlib.h> #include <assert.h> void fact(int n) { int i; mpz_t p; mpz_init_set_ui(p,1); for (i=1; i <= n ; ++i){ mpz_mul_ui(p,p,i); } printf ("%d! = ", n); mpz_out_str(stdout,10,p); mpz_clear(p); } int main(int argc, char * argv[]){ int n; if (argc <= 1) { printf ("Usage: %s <number> \n", argv[0]); return 2; } n = atoi(argv[1]); assert( n >= 0); fact(n); return 1; }
Anonymous
Does this works
Anonymous
?
Anonymous
so pointers must be used
Use smart pointers when possible.
Anonymous
Does this works
Didn't you tried to compile it?
Zeus
Hello developers..
Zeus
I need help!😂
Zeus
#include<stdio.h> #include<string.h> #include<iostream> using namespace std; void NthPrime(int input1) { int count,a=1,*prime; for(int i=3;i<=1000;i++) { count = 0; for(int j=2;j<=1000;j++) { if(i%j==0) { count ++; } } if(count == 1) { prime[a]=i; a++; } } cout<<prime[input1]; } int main() { NthPrime(5); }
Zeus
can anyone tell me what's wrong with this code?
Zeus
having this error while am running it
Ariana
btw put code in monospace
Zeus
btw put code in monospace
O am sorry about that! Although I got the fix.. thank you so much!
Zeus
prime is just an arbitrary pointer here
Yes I used prime[1000] instead of *prime; and it worked haha
Elbek
Hello please help me I want to run project from VS 2013 but it doesn't because error MSB4175 how I can fix it
Elbek
?
mark
MᏫᎻᎯᎷᎷᎬᎠ
Wow
Anonymous
Hy guys..Is there any easy way to print every type of pattern
S.
"every type of pattern" what's this?
Anonymous
Is that star pattern
Anonymous
Yes star and number patterns
Anonymous
Like 1 12 123 123 12 1 * * ***
S.
then there's no easy way, i guess
S.
what have you tried so far
Anonymous
Actually I just wanna learn how to frame them... Means how to arrange in a given position..
S.
print necessary spaces before them
Elbek
Google it
I have googled it but didn't find any solution
S.
Well i googled and found many solution. You could've said you've tried them but they didn't work
S.
maybe the simplest solution for you is to upgrade your vs
Anonymous
https://www.phoronix.com/scan.php?page=article&item=gcc9-core9-tuning&num=1
Mihail
/report
Death Killer
Hi
Death Killer
I c++ oop concepts have a great variety
Death Killer
I want to learn things in great depth and explore all possibilities
Death Killer
Which book you would suggest
Mihail
Best way to do that would be by actually doing it
Death Killer
But i will read and implement
Mihail
You don't need to read much
Mihail
And all the reading you'll need you can find online
Mihail
All the theory a book will give you, practice will give you but faster and in a way where you'd actually be able to use it
BinaryByter
i kinda agree but dissagree
BinaryByter
for learning, use practice
BinaryByter
for getting new ideas on how to pervert oop, read books
Victor
sl command has been over-played 😂
Bruce
void main reduces one step of programme i.e no need to type return 0,rather than int main.then why many people use int main in c programme?
BinaryByter
you dont have to return from int main
BinaryByter
+ in linux, what you return is the exit status
Ariana
exit takes an argument
Bruce
+ in linux, what you return is the exit status
But we generally type return 0. don't we?
BinaryByter
But we generally type return 0. don't we?
return -1; if you have an error, for example
Bruce
return -1; if you have an error, for example
But if we use void main I think no need to return any value ,so one step is reduced
Ariana
But if we use void main I think no need to return any value ,so one step is reduced
But the program doesn’t know what the return val should be
Ariana
So it just defaults to 0, which isn’t always what you want