Anonymous
i just provide correct version, i don't wanna argue
Alex
we need avg, not sum
Gianla.
best library to make GUIs on C?
Anonymous
template<class T> T sum(T t){ return t; } template<class T, class ... Args> T sum(T t,Args ... args){ return t+sum(args...); }
template <typename... Args> auto sum(Args... args) -> std::common_type_t<Args...> { return args + ...; }
Anonymous
C++ only
Gianla.
oh rlly?
Gianla.
why?
Anonymous
Bad language
Gianla.
C is bad?
Anonymous
Definitely
Gianla.
you think that it is old?
Anonymous
we need avg, not sum
template<class T> T avg(T t){ return t; } template<class T, class ... Args> double avg(T t,Args ... args){ auto a=sizeof...(args); return 1.0*(t+avg(args...)*a)/(a+1); }
Anonymous
that double return type really need to take some time to figure out
Pavel
that double return type really need to take some time to figure out
I think it can be improved with fold expressions, but not completely sure
Anonymous
what is fold expression?
Anonymous
parameter expand?
Pavel
what is fold expression?
C++17 feature that allows to write some variadics in more simple manner. I'll find an example in 20 minutes as get to the keyboard
Anonymous
no wonder i can't compile that simplified version
Anonymous
i add c++11 flag, cos that is the history command(c-r)
V01D
Writing an OS in C++ would suck! C is good for drivers and kernel. (Thats about it though)
Pavel
template<class T> T avg(T t){ return t; } template<class T, class ... Args> double avg(T t,Args ... args){ auto a=sizeof...(args); return 1.0*(t+avg(args...)*a)/(a+1); }
this would be C++17 implementation template<typename... Args> auto avg(Args... args) { return (args + ...) / sizeof...(args); } note auto as a return type to deduce return value type from the result of operator+ actually this can be written even shorter auto avg(auto... args) { return (args + ...) / sizeof...(args); }
Pavel
Anonymous
Nice
Aakarsh
Hey guys any thoughts on what could probably be a good SVN GUI utility for LINUX?
Dima
Why would you need such a dinosaur
Aakarsh
Just beginning with vcs and all and came across SVN wanted to know more about it
Aakarsh
Then, Is using GUI client for git good?
Roxifλsz 🇱🇹
Then, Is using GUI client for git good?
Sure, it's all about personal preference anyway
Anonymous
Hie guys can I get a c++ compiller
Kenny
For which OS?
M__
Hie guys can I get a c++ compiller
https://youtu.be/DIw02CaEusY
Gagan
Can i make app at phone
Gagan
Howz tell
klimi
Howz tell
Termux for example
Gagan
Or pc
Daniele
can I do something like item.getTexture().render(x, y) where item is a generic item of class Item, getTexture() is a method of Item and returns an object of class Texture, render(int x, int y) is a method of Texture
V01D
☝️ This is why OOP sucks ☝️
klimi
Or pc
Well sure
Gagan
Easy pc or mobile
Daniele
☝️ This is why OOP sucks ☝️
I believe you, but can I do it?
Vlad
Your Item must handle rendering by itself
Vlad
Via virtual draw method
Daniele
Well seems like you're doing it wrong.
most likely, since it doesn't work lol
Daniele
Via virtual draw method
mmm what's that? a virtual render in the Item?
Vlad
mmm what's that? a virtual render in the Item?
class Item { ... virtual void draw() = 0; }; ... class Pickup : public Item { virtual void draw() override { // does rendering } };
Daniele
will try later, thanks
Daniele
Yes))
but how do I render them then?
Daniele
I've tried messing with vectors and pointers and it didn't go well
Vlad
but how do I render them then?
class Button : public Base { public: virtual void draw() override { // Do the drawing } private: Texture tex; }
Vlad
Also your base class for an game object should have a texture field probably
Daniele
Also your base class for an game object should have a texture field probably
mmm so you make a base class with a bunch of virtual stuff and then all the other things (elements of the game and UI) are child (is this the word?) of this class?
Vlad
Also have a read about game patterns
Vlad
Will help a lot
Daniele
Also have a read about game patterns
yes that's what I was about to do next
Daniele
feels stupid to "refactor" the game only to find out that your architecture is lacking once again and have to refactor it again
😌
»
😌
i need help in bug c bug
Daniele
Then you probably lack knowledge how to do it, doncha? :P
well of course, I'm just starting out afterall and while not completely new to programming, I am completely new to OOP and while I know some C stuff, I'm completely new to classes and stuff
Andrew
What bug
😌
?????????????? anyone there to help me ?
😌
in c bug hunting
😌
/* PROBLEM STATEMENT The DSC RIT team wanted to make a very complex question for the participants on the Bug Bounty Challenge. They tried very hard but their program for the competition still had some bugs. Now they want your help to implement the following logic: You are given a string with some alphabets(a-z or A-Z) and digits(0-9). Here are the sequence of steps we are doing 1. Calculating the FREQUENCY of each digit that appeared in the string. 2. The count of each digit is stored in an array. 3. That array is passed to a function called HASH and that prints a string. 4. The string printed is your KEY for the NEXT QUESTION. Fix any bugs in this code and the DSC RIT team will give you the KEY for you to continue your journey and win the Bug Bounty Contest! INSTRUCTIONS 1. The hash function is correct and doing its job, please DO NOT MODIFY IT 2. THE INPUT is already handled for you. 3. You are supposed to fix the logic for counting the frequency of characters correctly and fix the bugs present. INPUT: Already Handled, Please don't touch the HEADER FILES. OUTPUT: 1. The OUTPUT Printed on your console is key to enter into website. 2. The OUTPUT is of the format: XXXXXXXohw */ #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <ctype.h> #include "helpers.h" int main() { char s; s = getString(); int arr[10],a; for (int i=0; i< strlen(s); i++) { if(isdigit(s[i])) { a=(int)s[i]-'O'; arr[a]++; } } hash(arr); return 0; }
Dima
/* PROBLEM STATEMENT The DSC RIT team wanted to make a very complex question for the participants on the Bug Bounty Challenge. They tried very hard but their program for the competition still had some bugs. Now they want your help to implement the following logic: You are given a string with some alphabets(a-z or A-Z) and digits(0-9). Here are the sequence of steps we are doing 1. Calculating the FREQUENCY of each digit that appeared in the string. 2. The count of each digit is stored in an array. 3. That array is passed to a function called HASH and that prints a string. 4. The string printed is your KEY for the NEXT QUESTION. Fix any bugs in this code and the DSC RIT team will give you the KEY for you to continue your journey and win the Bug Bounty Contest! INSTRUCTIONS 1. The hash function is correct and doing its job, please DO NOT MODIFY IT 2. THE INPUT is already handled for you. 3. You are supposed to fix the logic for counting the frequency of characters correctly and fix the bugs present. INPUT: Already Handled, Please don't touch the HEADER FILES. OUTPUT: 1. The OUTPUT Printed on your console is key to enter into website. 2. The OUTPUT is of the format: XXXXXXXohw */ #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <ctype.h> #include "helpers.h" int main() { char s; s = getString(); int arr[10],a; for (int i=0; i< strlen(s); i++) { if(isdigit(s[i])) { a=(int)s[i]-'O'; arr[a]++; } } hash(arr); return 0; }
/warn assignment request
😌
y am i warned?
Alex
/* PROBLEM STATEMENT The DSC RIT team wanted to make a very complex question for the participants on the Bug Bounty Challenge. They tried very hard but their program for the competition still had some bugs. Now they want your help to implement the following logic: You are given a string with some alphabets(a-z or A-Z) and digits(0-9). Here are the sequence of steps we are doing 1. Calculating the FREQUENCY of each digit that appeared in the string. 2. The count of each digit is stored in an array. 3. That array is passed to a function called HASH and that prints a string. 4. The string printed is your KEY for the NEXT QUESTION. Fix any bugs in this code and the DSC RIT team will give you the KEY for you to continue your journey and win the Bug Bounty Contest! INSTRUCTIONS 1. The hash function is correct and doing its job, please DO NOT MODIFY IT 2. THE INPUT is already handled for you. 3. You are supposed to fix the logic for counting the frequency of characters correctly and fix the bugs present. INPUT: Already Handled, Please don't touch the HEADER FILES. OUTPUT: 1. The OUTPUT Printed on your console is key to enter into website. 2. The OUTPUT is of the format: XXXXXXXohw */ #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <ctype.h> #include "helpers.h" int main() { char s; s = getString(); int arr[10],a; for (int i=0; i< strlen(s); i++) { if(isdigit(s[i])) { a=(int)s[i]-'O'; arr[a]++; } } hash(arr); return 0; }
s is not string, s is char
Vlad
It could be a long trip if you do all the mistakes by yourself
😌
anyone knows c here???
Daniele
I'd suggest you to look how people do it first.
yes that's what I'm goung to do