Vlad
I can code this shiet, but that's gonna cost ya three hundred vbucks
Z0OM
Compile time error
not happening
Anonymous
not happening
Then destructor is there
Z0OM
its not
Vlad
not happening
Then you've got default destructor
Vlad
It is not = delete d
Z0OM
if my template class has pointer members of the template datatype and i delete them in the destructor. everyrhings ok?
Z0OM
umm its big
Vlad
Especially if your class is clearly a data owner
Vlad
Use unique_ptr's instead
Z0OM
ok going to read docs. thankyou
Anonymous
ok going to read docs. thankyou
Please read Modern and Effective C++ book
Vlad
VB SUCKS... Even though back in 1996, I started Windows programming using VB... but trust me it SUCKS.
I know a guy who wrote 2d game engine in VB back in the day :P. He works at Sega now
Talula
I know a guy who wrote 2d game engine in VB back in the day :P. He works at Sega now
Good for him but I'm sure in Sega he doesn't work on VB anymore.
Z0OM
one more thing visual studio gave an error invalid address specified to RtlValidateHeap(...) upon deletion of a pointer. what could be the reason?
Vlad
Looks like you should cover the basics first, bruh.
Z0OM
yes it was
Vlad
yes it was
Double free?
Z0OM
is someone free? i really need help. i have spent 1 and a half days to figure out just whats wrong with code. tried debugging logging output. but i am unable to figure out whats wrong. if someone can buy the time to look in my code I would be very thankful. but code is very big. multiple classes. ~Thankyou
Vlad
>multiple classes >big That's how many? 5 or smth? :P
Z0OM
i guess the mistake is somewhere in one of the 3 classes.
Merazi
The rules actually say the same thing ;)
True, dev c++ and turbo c++
Z0OM
sfml
M.Khorram
sfml
Oh Sorry, I cannot install that library
Vlad
sfml
Are you sure that you link proper binaries? Release-release and vice versa?
Z0OM
yes linking is fine. there are no errors. but code is not doing what i want it to. the problem is in basic c++.
Deleted Account
I'm going crazy by libuv, shit-like handle off. uv_timer_t this immediate end is going to have to wait to close.
Don Peter Joseph
#include<stdio.h> #include<stdlib.h> #include<conio.h> struct poly{ int coeff; int exp; }*p1,*p2,*p3; main(){ int n1,n2,n3,i,j=0,k=0; printf("enter the no of terms of two polynomials:"); scanf("%d%d",&n1,&n2); p1=(struct poly*)malloc(n1*sizeof(struct poly)); p2=(struct poly*)malloc(n2*sizeof(struct poly)); printf("enter the total no of different exponents in the two polynomials:"); scanf("%d",&n3); p3=(struct poly*)malloc(n3*sizeof(struct poly)); printf("enter the coefficient and exponent of first polynomial in decreasing order of exponents:"); for( i=0;i<n1;i++) scanf("%d%d",&p1[i].coeff,&p1[i].exp); printf("enter the coefficient and exponent of second polynomial in decreasing order of exponents:"); for(i=0;i<n2;i++) scanf("%d%d",&p2[i].coeff,&p2[i].exp); for(i=0;i<n1&&1<n2;i++){ if(p1[i].exp>p2[j].exp) { p3[k].exp=p1[i].exp; p3[k].coeff=p1[i].coeff; k++; } else if(p1[i].exp<p2[j].exp){ p3[k].exp=p2[j].exp; p3[k].coeff=p2[j].coeff; k++; j++; } else{ p3[k].exp=p1[i].exp; p3[k].coeff=p1[i].coeff+p2[j].coeff; k++; j++; } } while(i<n1){ p3[k].coeff=p1[i].coeff; p3[k].exp=p1[i].exp; k++; i++; } while(i<n2){ p3[k].coeff=p2[j].coeff; p3[k].exp=p2[j].exp; k++; j++; } printf("the resultant polynomial is :"); for(i=0;i<n3;i++){ printf("%d*x^%d ",p3[i].coeff,p3[i].exp); if(++i<n3) printf("+"); } }
Don Peter Joseph
#include<stdio.h> #include<stdlib.h> #include<conio.h> struct poly{ int coeff; int exp; }*p1,*p2,*p3; main(){ int n1,n2,n3,i,j=0,k=0; printf("enter the no of terms of two polynomials:"); scanf("%d%d",&n1,&n2); p1=(struct poly*)malloc(n1*sizeof(struct poly)); p2=(struct poly*)malloc(n2*sizeof(struct poly)); printf("enter the total no of different exponents in the two polynomials:"); scanf("%d",&n3); p3=(struct poly*)malloc(n3*sizeof(struct poly)); printf("enter the coefficient and exponent of first polynomial in decreasing order of exponents:"); for( i=0;i<n1;i++) scanf("%d%d",&p1[i].coeff,&p1[i].exp); printf("enter the coefficient and exponent of second polynomial in decreasing order of exponents:"); for(i=0;i<n2;i++) scanf("%d%d",&p2[i].coeff,&p2[i].exp); for(i=0;i<n1&&1<n2;i++){ if(p1[i].exp>p2[j].exp) { p3[k].exp=p1[i].exp; p3[k].coeff=p1[i].coeff; k++; } else if(p1[i].exp<p2[j].exp){ p3[k].exp=p2[j].exp; p3[k].coeff=p2[j].coeff; k++; j++; } else{ p3[k].exp=p1[i].exp; p3[k].coeff=p1[i].coeff+p2[j].coeff; k++; j++; } } while(i<n1){ p3[k].coeff=p1[i].coeff; p3[k].exp=p1[i].exp; k++; i++; } while(i<n2){ p3[k].coeff=p2[j].coeff; p3[k].exp=p2[j].exp; k++; j++; } printf("the resultant polynomial is :"); for(i=0;i<n3;i++){ printf("%d*x^%d ",p3[i].coeff,p3[i].exp); if(++i<n3) printf("+"); } }
Can anyone say where I went wrong.its polynomial addition
Harsha [M]
#include<stdio.h> #include<stdlib.h> #include<conio.h> struct poly{ int coeff; int exp; }*p1,*p2,*p3; main(){ int n1,n2,n3,i,j=0,k=0; printf("enter the no of terms of two polynomials:"); scanf("%d%d",&n1,&n2); p1=(struct poly*)malloc(n1*sizeof(struct poly)); p2=(struct poly*)malloc(n2*sizeof(struct poly)); printf("enter the total no of different exponents in the two polynomials:"); scanf("%d",&n3); p3=(struct poly*)malloc(n3*sizeof(struct poly)); printf("enter the coefficient and exponent of first polynomial in decreasing order of exponents:"); for( i=0;i<n1;i++) scanf("%d%d",&p1[i].coeff,&p1[i].exp); printf("enter the coefficient and exponent of second polynomial in decreasing order of exponents:"); for(i=0;i<n2;i++) scanf("%d%d",&p2[i].coeff,&p2[i].exp); for(i=0;i<n1&&1<n2;i++){ if(p1[i].exp>p2[j].exp) { p3[k].exp=p1[i].exp; p3[k].coeff=p1[i].coeff; k++; } else if(p1[i].exp<p2[j].exp){ p3[k].exp=p2[j].exp; p3[k].coeff=p2[j].coeff; k++; j++; } else{ p3[k].exp=p1[i].exp; p3[k].coeff=p1[i].coeff+p2[j].coeff; k++; j++; } } while(i<n1){ p3[k].coeff=p1[i].coeff; p3[k].exp=p1[i].exp; k++; i++; } while(i<n2){ p3[k].coeff=p2[j].coeff; p3[k].exp=p2[j].exp; k++; j++; } printf("the resultant polynomial is :"); for(i=0;i<n3;i++){ printf("%d*x^%d ",p3[i].coeff,p3[i].exp); if(++i<n3) printf("+"); } }
!report ..
Vlad
What about codeblocks?
Also outdated trash
Merazi
Also outdated trash
last update was on Thursday, 19 March 2020
Vlad
last update was on Thursday, 19 March 2020
As far as I know it supports only MinGW and vs2010 compilers
Vlad
And mingw still hasn't got c++17 implemented
Vlad
And also a pain in the ass to develop for
Merazi
And mingw still hasn't got c++17 implemented
but it supports GNU GCC, that even supports the new c++20
Vlad
And it drags. And always did.
Merazi
Then codeblocks would be good only if you're running linux(?
Vlad
The only reason in the universe to use it. That if you port posix heavy program on windows
Vlad
Then codeblocks would be good only if you're running linux(?
It's fine for linux. But editor is still dated and lacks some functionality.
Andrew
Then codeblocks would be good only if you're running linux(?
no, there better code editors on linux for C
Anonymous
Hi do you guys answer c programming questions?
Talula
Hi do you guys answer c programming questions?
Depends... if it's not based on question paper.
Don Peter Joseph
i have a doubt
Don Peter Joseph
p1=(struct poly*)malloc(n1*sizeof(struct poly));
Don Peter Joseph
can i write like this where p1 is not a pointer
Don Peter Joseph
c
Don Peter Joseph
p1 is a structure variable
Anonymous
p1 is a structure variable
Do you expect this to work?
Don Peter Joseph
i dont know
olli
And mingw still hasn't got c++17 implemented
Are you sure about that? My MinGW GCC supports coroutines and quite some C++ 20 features. A lot of MinGW patches are accepted upstream by GCC, just count how often "mingw" is mentioned in their codebase I don't see where all the "hate" for mingw comes from, it's easy to setup, easy to use and at least my version is pretty much up to date with upstream.
V01D
p1 is a structure variable
I dont think that works
olli
can i write like this where p1 is not a pointer
If your compiler implements uintptr_t you can do this uintptr_t p1 = (uintptr_t)malloc(n1* sizeof(struct poly)); I don't know whether this would make sense in your case tho, why not just use a pointer?
V01D
/report ethical homework go brrrrr
Andrew
i want to make a question, do you guys prefer if(statement) { expression } or if(stamement){ expression }
V01D
We prefer a pasting service
M.Khorram
What about codeblocks?
codeblocks might lack some functionalities as other said. But, considering the smaller size of installer, I guess that codeblocks is more appropriate for not powerful computers. It also has wxsmith (a visual editor for wxwidgets) which makes it one of few options for this
Anonymous
i dont know
Then read books
Anonymous
Termux is your way to write programs on the phone
Merazi
I use the phone (termux) for doing quick tests only
Anonymous
I'm talking about small programs
Merazi
I use the phone (termux) for doing quick tests only
when I don't have my computer available
Anonymous
I'm talking about small programs
But with full-featured compilers
Anonymous
But with full-featured compilers
With the right phone termux can do anything
Anonymous
With the right phone termux can do anything
Contribute to Chromium from the right phone