Diego
Well, to finish this point there's this http://www.agner.org/optimize/#manual_instr_tab
Epem
Why would it take 3 cycles for a single instruction though?
There are two instructions. But a single instructions can take more that one cycle depending upon the function
Diego
For (I=0; i<slices;I++) { X=(I+0.5) *0.0006 Cout<<X; Sum+=///// }
But anyway.. as for the amount of elements in the loop, if X is the element in question, then shouldn't slices be your answer?
Epem
Slices is the number of interation actually.
Diego
Yes, and in that loop I see only one element being transferred (to cout) , per iteration, no?
Epem
I donno my brain is dead I have been stuck for this for 1 hour 🤣. I'il think again about it now
Epem
It has a program for measuring it
Diego
No worries, happens to the best of us
Dj Jerry 255
Thanks alot
Prince Of Persia
hi guys
Prince Of Persia
I know it is a pointer to a void function that gets char* void (*print)(char*); but what is the type of it?
Prince Of Persia
I mean what can I write in typedef
Prince Of Persia
like this typedef sometype myFunPointer;
Ammar
like this typedef sometype myFunPointer;
It is like declaring a variable. But the variable name be a type name. typedef void (*myFunPointer)(char*); MyFunPointer ptr = theFunc;
[Gaal wase bilaa cashuur ]?_ 2 grals
😃
A
Does anyone know how to keep tracking moves the shortest path in 2D grid using bfs?
armandofsanchez
Hi guys! Can you help me please?! I want shift one column in array, but my experience and Google don't help me ( Example Source array 1 2 3 4 5 6 7 8 9 Results array 1 _ 3 4 2 6 7 5 9 Where 8 will be deleted and _ is empty. if you shared C example, i will be pleasure! thanks!
char values[N][N]={{'1','2','3'},{'4','5','6'},{'7','8','9'}}; for(int i=0;i<N;i++) { for(int j=0;j<N;j++) { cout << values[i][j] <<endl; } } for(int i=N-1;i>=0;i--) { values[i][1]=values[i-1][1]; }; values[0][1]='_';
[Gaal wase bilaa cashuur ]?_ 2 grals
I can help you
MᏫᎻᎯᎷᎷᎬᎠ
https://github.com/NARKOZ/hacker-scripts
MᏫᎻᎯᎷᎷᎬᎠ
This is funny hahhahahah
[Gaal wase bilaa cashuur ]?_ 2 grals
This is funny hahhahahah
Is not funny bro are you serious
Bumpy
hey everyone. i have an object that calls NumberWithUnits that contains 2 data members , double data and string unit. » class NumberWithUnits { double value; string unit; ............ } the mission is to overload the input operator. and i need to succsess in this test : TEST_CASE("<< / >> function after second read") { NumberWithUnits temp_output(2, "r_class"); NumberWithUnits temp_output1(3, "r_student"); ostringstream oss; oss << temp_output << " " << temp_output1; CHECK_EQ(oss.str(), "2[r_class] 3[r_student]"); NumberWithUnits a(7, "r_ILS"); NumberWithUnits b(7, "r_ILS"); NumberWithUnits c(7, "r_ILS"); istringstream iss{" 8 [ r_EUR ] -1 [r_school ] 29.7 [r_halfMin ]"}; iss >> a >> b >> c; CHECK_EQ(a, NumberWithUnits(8, "r_EUR")); CHECK_EQ(b, NumberWithUnits(-1, "r_school")); CHECK_EQ(c, NumberWithUnits(29.7, "r_halfMin")); }
Bumpy
what you are suggest to do?
Bumpy
its really important to me
[Gaal wase bilaa cashuur ]?_ 2 grals
[Gaal wase bilaa cashuur ]?_ 2 grals
Welcome
Hamid
I have a folder named include for header files and a lib folder for libraries -proj/ include/ .... lib/ jagpdf-1.4.dll jagpdf-1.4.lib test/ tpdf.cpp but when i enter following command in proj folder,: g++ -I.\include\ -L.\lib\ -ljagpdf .\test\tpdf.cpp mingw says: """ cannot find -ljagpdf collect2.exe: error: ld returned 1 exit status """ it recognizes header files but not library files any idea? https://stackoverflow.com/questions/67210830/cannot-link-external-libraries-with-my-cpp-code
[Gaal wase bilaa cashuur ]?_ 2 grals
You're welcome
Hamid
perhabs -L .\lib -ljagpdf-1.4 ?
cannot find -ljagpdf-1.4 collect2.exe: error: ld returned 1 exit status
Hamid
i'm really stuck in c/cpp
Suka
cannot find -ljagpdf-1.4 collect2.exe: error: ld returned 1 exit status
ooo ic. try remove the version number from .lib file? cmiiw
Mohammad Taha
[Gaal wase bilaa cashuur ]?_ 2 grals
War yaa meeshaan soomaali ah
Hamid
ooo ic. try remove the version number from .lib file? cmiiw
with new file name: lib/ jagpdf.dll jagpdf.lib it says: cannot find -ljagpdf collect2.exe: error: ld returned 1 exit status
[Gaal wase bilaa cashuur ]?_ 2 grals
Okay
Hamid
What does this mean? (sockaddr*)& ServerInfo https://github.com/amirrezatav/cppSocketP/blob/main/ServerSock.cpp#L36
Kamuri
Hey guys how to count how many times a number appears in a 2d array? I've tried some method but didn't worked
Kamuri
Hamid
Can you send your code to find the problem?
Anonymous
Hey guys how to count how many times a number appears in a 2d array? I've tried some method but didn't worked
in such case it's better to see what you've tried to help you figure out what you did wrong
Kamuri
in such case it's better to see what you've tried to help you figure out what you did wrong
after struggling, tried to do a bubblee sort, but... https://gist.github.com/Kamuri-chan/9ac977ec90c11e5295c64f0154cd60ef
Kamuri
I dont think that's difficult
i dont have experience with 2d arrays t.t
Anonymous
after struggling, tried to do a bubblee sort, but... https://gist.github.com/Kamuri-chan/9ac977ec90c11e5295c64f0154cd60ef
I can't read the comment or understand the purpose of the variables, just guess them, because I can't read this language. can you please translate it to english?
Anonymous
Done
have you tried to compile it? (its just that there's a typo in line 9, and you return a pointer in line 13 while the function is supposed to return an int)
Hamid
Done
Why did u use 3 for loop for 2d array,
Hamid
Just put a counter top of your for loop and count occurrence of desired value
Kamuri
yes
Anonymous
The typo was from translating. And the return is just a warning
its not just a warning.... you can convert a pointer to an int, but what do you achieve from it?
Anonymous
count_elems should return the sum of the elements?
Kamuri
its not just a warning.... you can convert a pointer to an int, but what do you achieve from it?
man, im learning on my own for fun, just started with c, that's why i'm asking for help. Please, if you want to say anything, give a hint. is bad to convert a pointer to int? idk, nobody told me so (as i said before, its a warning, the code runs and idk how to do it otherway)
Anonymous
Anonymous
just show on screen
https://t.me/programminginc/383324 what about that? where's the function you had a problem with?
NAM3L3SS
I'm trying to help; you don't do anything with the return value, so nothing bad happens. you can just change it to void and don't return anything if you don't need to.
I think a pointer is like a memory address for the data or data types input so calling a pointer is basically calling the address using it isn't wrong but as someone said what do you achieve from it except for calling the memory address
NAM3L3SS
Just what I think
NAM3L3SS
Correction if anything said is wrong
Anonymous
I think a pointer is like a memory address for the data or data types input so calling a pointer is basically calling the address using it isn't wrong but as someone said what do you achieve from it except for calling the memory address
a pointer is a memory address. not like a memory address. so yeah, pointer is also just a number, but what do you get from converting a pointer to an int? he didn't done anything with it, so nothing bad happened, but if you'd try to, for example, convert it back to a pointer, weird things might happen from this conversion since int may be smaller than a pointer.
Anonymous
A pointer its not a memory adress wtf what are saying
a pointer is a virtual memory address