Anonymous
The user will identify the teams and the players lefts overs. Write the pseudocode and draw the corresponding flowchart given the following conditions; How many players do you wish per team? (Enter a value in the range 9-15):4 Team size should be 9 to 15 players. How many players do you wish per team? 12 How many players are available: -142 Please enter a positive number: 142 There will be 11 teams with 10 players left over.
Alex
What about )( or even {[}] ??
)( - check every time is closed. initial value - 0. check ')' - decrement 0 = -1; -1 is less than 0, so this is error. about multiquotes it depends on task
Alex
I didn't get it... You're doing it in my approach
no. you check counter only one time in the end. you should check it every time for closing bracket and in the end too
Roshan
Anyone else having a different approach than mine?
Alex
you could use also stack: push for (, and pop for ). in the end stack must be empty
Roshan
Do it using stack
Ok I got it from geeksforgeek!
mov $22, %rax
int euclides(int a, int b) { a += b -= a = b - (a = a % b); if(!b) return a; return euclides(a, b); }
mov $22, %rax
Can you do better?
Anonymous
Can you do better?
The right question is "can you do worse?"
I_Interface
I_Interface
yeah quite
Separate these operations.
mov $22, %rax
:(
_waͣrͬdͩaͣdͩdͩy_
Ok I got it from geeksforgeek!
https://github.com/strikersps/Competitive-Programming/tree/master/Hacker-Rank/Balanced-Brackets
I_Interface
Such a bad C++ code...
"Can you do worse"?
_waͣrͬdͩaͣdͩdͩy_
Such a bad C++ code...
Why it is bad man?
Anonymous
Why it is bad man?
Macros, typedefs, so much spaces
Anonymous
At least variable names are not bad
I_Interface
Why it is bad man?
Read more about modern C++. And code conventions.
I_Interface
Yes do (a %= b) 🤣
No, please, God, no. 😂
_waͣrͬdͩaͣdͩdͩy_
Macros, typedefs, so much spaces
Actually the code is a generalized framework which I used for Competitive Programming thats why its like that although from CP perspective its still readable.
_waͣrͬdͩaͣdͩdͩy_
mov $22, %rax
Yes do (a %= b) 🤣
yeah, a little better, if better means shorter
Anonymous
Guys, why can't you be cuddly like sheep?
Anonymous
But you guys creep me out. I don't dare post any question unless I ultimately got no solution .
mov $22, %rax
Roshan
How would you do that
I saw that long expression evaluates to b
mov $22, %rax
I saw that long expression evaluates to b
it puts (a % b in b) and (old b in a), but the final result is in a (the final outcome is the GCD of the two numbers)
mov $22, %rax
😶 Thought was a mess... Didn't go through it. Well! 😅
Yeah it is pretty unreadable, but quite efficient. Hadn't I written it, I wouldn't have been able to understand.
Shvmtz
Where can I get the best implementation for data structures ?
Igor🇺🇦
Yeah it is pretty unreadable, but quite efficient. Hadn't I written it, I wouldn't have been able to understand.
You do know that that there is https://en.cppreference.com/w/cpp/numeric/gcd, don't you?
Cristi
#include<stdio.h> #include<stdlib.h> int* Suma(int **a,int nl, int nc) { int i,j,Sum; int *b; b=(int *)malloc(nc*sizeof(int)); for (i=0; i<nc; i++){ Sum = 0; for (j=0;j<nl;j++){ Sum = Sum + a[j][i]; } b[i] = Sum; } return b; } int main(){ int i, nl, nc; int *b; puts("Give the number of rows:"); scanf("%d",&nl); puts("Give the number of columns:"); scanf("%d", &nc); // Alloc memory to 2D array int **a = (int **)malloc(nl *sizeof(int*)); for(i=0;i<nl;i++){ a[i] = (int *)malloc(nc*sizeof(int)); } // Form 2D Array int q,w; for (q=0;q<nl;q++){ for (w=0;w<nc;w++) a[q][w] = rand()%100-50 ; } // Show 2D array int e,r; for (e=0;e<nl;e++){ for (r=0;r<nc;r++) { printf ("%d\t", a[e][r] );} printf("\n"); } // Call Function b = Suma(a, nl, nc); printf("\nElements of array: \n"); for (int l;l<nc;l++){ printf("%d", b[l]); } }Why the last operation (show elements of 1D array from function) doesen't work ?
Lava
Do Anti-virus softwares reduce IDE execution time ? I used one and now even a hello takes 40-60 sec to run .
Lava
just use linux
That will reduce run time ?
Anonymous
just use linux
Less software library compared to windows and I can't keep up with its daily updates.
Igor🇺🇦
Yeah but, what's the fun
Certainly not in writing a += b -= a = b - (a = a % b)
Anonymous
That will reduce run time ?
if your project is not complex just use a simple text editor and compile using gcc
Igor🇺🇦
That will reduce run time ?
No, it won't. It's just a fanboy talk.
Lava
I am compiling on gcc just I think the anti virus softwares is causing it to take a long time to run. cout<<"Hello"; took 45 seconds
Anonymous
True but less of the popular, would require making lots of adjustments.
Lava
Ou ok
Anonymous
your anti-virus software might be checking every executable, why not test it by temporarily stopping your anti virus? if yes, well there it is.
Anonymous
your anti-virus software might be checking every executable, why not test it by temporarily stopping your anti virus? if yes, well there it is.
Well, windows defender is great for a non-serious work kind of PC, and won't slow down your PC.
Anonymous
Do Anti-virus softwares reduce IDE execution time ? I used one and now even a hello takes 40-60 sec to run .
My windows defender used to removed my compiled Hello world C program cuz it identified it as a dangerous virus..
Anonymous
If u r using windows defender , make an exception for the folder where the compiled files are stored in..
Dima
> using antivirus software in 2020 🤔🤔
Anonymous
I don't know but I feel that lol is a stupid statement and less probable, except if you don't mind people calling you crazy for most scenes. A simple funny-depicting emoji should do. Just saying, you know?
Anonymous
hi
Anonymous
i’ve got a problem to programs in C++ with struct
Anonymous
can you help me?
I_Interface
can you help me?
Don't ask for ask. Type your question about a problem at the first place.
Anonymous
I’ve a programme where C++ is created in language a structure carrier of 10 elements of this kind: a char and a int . It is: to load the elements into the carrier by asking for values from the user; to print all elements of the carrier; it is intended to add all the entire parts contained in the codes and print the sum by video.
Anonymous
i’ve using namespace std; #include<stdio.h> #include <stdiolib.h> system (“color F5”); main (){ struct code N[10]{ int m; char f; and now? what I can do? I MUST Continue it
Anonymous
Your struct syntax is off. struct code { // something }; declare "struct code N[10]" either in global or local
Anonymous
Also I don't understand what "carrier" means.
Anonymous
I’ve a italian track not english, and google traslate has translate like this