Anonymous
for C you have The C Programming LAnguage from Ritche and Kernighan
Anonymous
you have the books from Meyers and many more, but those books are for advanced or at least you will need some level
Azzam
I have a 2D array(vector<vector<>>) of size MxN, I want to create a new vector in which I want to add some of these vectors but unable to add these directly or without using loops.... is there any solution?? Thank you !
Anonymous
you will need some years too :D
Anonymous
you could create one vector instead of a vector of vectors
Anonymous
I mean, you could create sth like: vector<> v;
Anonymous
v.resize(M*N);
Azzam
I mean, you could create sth like: vector<> v;
In this I want to add all the vectors stored in vector<vector<<>>
Anonymous
yes, for sure
Anonymous
I told you
Azzam
🙋‍♂
Anonymous
instead of: vector<vector<>> v; -> vector<> v; v.resize(M*N);
Anonymous
so you can create a new vector and assign or whatever
Anonymous
Anonymous
conceptually is the same
Azzam
Wait... Let me research about it
Anonymous
yes, you need to research :D
Azzam
Any good resources for STL?
Anonymous
in C there is no difference between int a[30][30]; and int a[30*30];When I said: there is no difference, I meant that the memory is contiguous
Anonymous
in C++ with vectores is somewhat different but conceptually, it's the same
Anonymous
Anonymous
When I said: there is no difference, I meant, in terms of memory
Azzam
Thanks
Anonymous
do some research, read (and buy) good books (Stroustrupo, Meyers, Herb, ...)
Anonymous
and you will understand
Anonymous
🙋‍♂
Anonymous
/rules
Dhanrz
can someone help me on this problem...this is past final test...i am newbie on using array
#include<stdio.h> #include<conio.h> void main() { int a[50],n,i,j,dif,mdif; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=0;i<n;i++){ for(j=0;j<n;j++) { if(i!=j){ dif=abs(a[i]-a[j]); if(dif<=mdif) { mdif=dif; } } } } printf("%d",mdif); return ; }
olli
It runs fyn
it does not produce the correct result
MilkBeforeCereal
It runs fyn
it's wrong
MilkBeforeCereal
you'll get diff as 0
MilkBeforeCereal
Dhanrz
j=i+1 plox
It’s same a using if(i!=j)
MilkBeforeCereal
costly af
MilkBeforeCereal
It’s same a using if(i!=j)
altho I did miss that
MilkBeforeCereal
altho I did miss that
you're repeating the same steps unnecessarily
Dhanrz
I’m still a beginner;
Dhanrz
you're repeating the same steps unnecessarily
Plz suggest source to learn efficient algorithms
MilkBeforeCereal
I never learned anything like that myself
Ilya
Plz suggest source to learn efficient algorithms
Cormen, Thomas H.; Leiserson, Charles E.; Rivest, Ronald L.; Stein, Clifford. Introduction to Algorithms. — 2nd. — MIT Press and McGraw-Hill, 2001. — ISBN 0-262-53196-8.
Anonymous
I need some notes on 2d array for class 12
olli
I need some notes on 2d array for class 12
All the array information you need https://en.cppreference.com/w/cpp/language/array
Anonymous
Boolean algebra
Anonymous
Hii
Anonymous
Can someone give me a real life application of a Binary search tree or simply a tree
Anonymous
#googleit
I did but found no proper blog or page
Sunny
👍
fiuyang
Hai
I_Interface
Hai
#meta
I_Interface
Hai
#howtoask
विशाल
Okay
Dhanrz
|error: '::main' must return 'int'|
Dhanrz
|error: '::main' must return 'int'|
Is this error due to compiler bc in Ubuntu void main () works fyn bt same code is showing error on win
Anonymous
on windows, it's different
Anonymous
on windows it should be something like wWinMain()
Anonymous
look at here: https://docs.microsoft.com/en-us/windows/win32/learnwin32/winmain--the-application-entry-point
Anonymous
on Ubuntu and UNIX related systems is int main(int argc, char *argv[])
MᏫᎻᎯᎷᎷᎬᎠ
https://youtu.be/PBZBG4nZXhk
Элвин
Hey
Элвин
I need best channel for learning c++
Элвин
Where can i learn