Dave
Hello, is online course and reading books makes me good programmer??
Dave
Oh, which country is best to learn programming??
Dave
it's a start
So i must learn in university??
Anonymous
that depends on you and on how good you are good at learning on your own. Usually people go to univ, but even that it's only a start
Anonymous
if you want to be a good developer you have to study and practice for the rest of your life
Dave
Oh, ok so it takes lot of time to become a software developer??
Dave
Do u any books that i learn programming easily??
Dave
Ok. are u know any summer programs in c++. I want to get scholarship??
Liam
/cpp_clang@rextester_bot
Anonymous
/cpp_clang@rextester_bot
Ok, give me some Cpp_clang code to execute Send it as text, or pass a file
Liam
Ok, give me some Cpp_clang code to execute Send it as text, or pass a file
#include <stddef.h> #include <iostream> class Base { public: virtual void f() { std::cout << "Your are calling Base::f (public)." << std::endl; } private: virtual void g() { std::cout << "Your are calling Base::g (private)." << std::endl; } }; class Derived : public Base{}; using funcptr_t = void(*)(void); using ptr_t = uint64_t*; funcptr_t fuckcxx(Base* const ptr, const ptrdiff_t offset) { ptr_t pvtbl = reinterpret_cast<ptr_t>(ptr); ptr_t pfunc = reinterpret_cast<ptr_t>(*pvtbl); return reinterpret_cast<funcptr_t>(*(pfunc + offset)); } int main() { Derived d; auto f = fuckcxx(&d, 0); auto g = fuckcxx(&d, 1); f(); g(); return 0; }
Liam
/cpp_clang #include <iostream> #include <future> template <typename IntT, typename UnaryFunc> IntT do_hyper_sum(const IntT begin, const IntT end, const UnaryFunc func) { IntT res = 0; for (IntT i = begin; i != end; ++i) { res += func(i); } return std::move(res); } template <typename IntT, typename UnaryFunc> IntT do_hyper_sum_parallel(const IntT begin, const IntT end, const UnaryFunc func) { static const constexpr size_t kParallelThrd = 100; const size_t diff = end - begin; if (diff <= kParallelThrd) { return do_hyper_sum(begin, end, func); } const IntT mid = begin + diff / 2; auto handler = std::async(std::launch::async, do_hyper_sum_parallel<IntT, UnaryFunc>, mid, end, func); const IntT res = do_hyper_sum_parallel(begin, mid, func); return std::move(res + handler.get()); } template <typename IntT, typename UnaryFunc> bool hyper_sum(const IntT begin, const IntT end, const UnaryFunc func, IntT* const res) { if (not(begin < end)) { return false; } if (nullptr == res) { return false; } *res = do_hyper_sum_parallel(begin, end, func); return true; } int main() { using IntT = long long int; IntT begin = 1; IntT end = 1000; IntT res = 0; auto func = [](const IntT num){ return num * num + num * num * num; }; if (hyper_sum(begin, end, func, &res)) { std::cout << res << std::endl; } return 0; }
Anonymous
/cpp_clang #include <iostream> #include <future> template <typename IntT, typename UnaryFunc> IntT do_hyper_sum(const IntT begin, const IntT end, const UnaryFunc func) { IntT res = 0; for (IntT i = begin; i != end; ++i) { res += func(i); } return std::move(res); } template <typename IntT, typename UnaryFunc> IntT do_hyper_sum_parallel(const IntT begin, const IntT end, const UnaryFunc func) { static const constexpr size_t kParallelThrd = 100; const size_t diff = end - begin; if (diff <= kParallelThrd) { return do_hyper_sum(begin, end, func); } const IntT mid = begin + diff / 2; auto handler = std::async(std::launch::async, do_hyper_sum_parallel<IntT, UnaryFunc>, mid, end, func); const IntT res = do_hyper_sum_parallel(begin, mid, func); return std::move(res + handler.get()); } template <typename IntT, typename UnaryFunc> bool hyper_sum(const IntT begin, const IntT end, const UnaryFunc func, IntT* const res) { if (not(begin < end)) { return false; } if (nullptr == res) { return false; } *res = do_hyper_sum_parallel(begin, end, func); return true; } int main() { using IntT = long long int; IntT begin = 1; IntT end = 1000; IntT res = 0; auto func = [](const IntT num){ return num * num + num * num * num; }; if (hyper_sum(begin, end, func, &res)) { std::cout << res << std::endl; } return 0; }
Errors: /usr/bin/ld: /tmp/source-98a722.o: undefined reference to symbol 'pthread_setspecific@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line clang: error: linker command failed with exit code 1 (use -v to see invocation) Tip: Mistake? Edit your message, I'll adjust my response.
Liam
faint...
Liam
/cpp_clang #include <iostream> #include <string> #include <vector> using std::vector; using std::string; using std::cout; using std::endl; template<typename Cont> struct container_traits { using value_type = typename Cont::value_type; }; template<typename T> struct container_traits<T*> { using value_type = T; }; template<typename T> using get_type = typename container_traits<T>::value_type; int main() { get_type<vector<int>> a = 1; get_type<string*> b = "Hello type function!"; get_type<decltype(b.begin())> c = 'c'; cout << a << endl; cout << b << endl; cout << c << endl; return 0; }
Liam
/cpp_clang #include <iostream> #include <algorithm> #include <bitset> #include <numeric> #include <utility> int main() { for (int queens[] = {0,1,2,3,4,5,6,7}; ::std::next_permutation(queens,queens+8); ) if ((::std::bitset<15>(::std::accumulate(queens,queens+8, ::std::make_pair(0, 0), [](::std::pair<int, int> a, int b){return ::std::make_pair((1<<(b+a.second))|a.first,a.second+1);}).first).count() == 8) && (::std::bitset<15>(::std::accumulate(queens, queens+8, ::std::make_pair(0, 0), [](::std::pair<int, int> a, int b){return ::std::make_pair((1<<(7+b-a.second))|a.first, a.second+1);}).first).count() == 8)) ::std::cout << queens[0] << queens[1] << queens[2] << queens[3] << queens[4] << queens[5] << queens[6] << queens[7] << ::std::endl; }
Anonymous
/cpp_clang #include <iostream> #include <algorithm> #include <bitset> #include <numeric> #include <utility> int main() { for (int queens[] = {0,1,2,3,4,5,6,7}; ::std::next_permutation(queens,queens+8); ) if ((::std::bitset<15>(::std::accumulate(queens,queens+8, ::std::make_pair(0, 0), [](::std::pair<int, int> a, int b){return ::std::make_pair((1<<(b+a.second))|a.first,a.second+1);}).first).count() == 8) && (::std::bitset<15>(::std::accumulate(queens, queens+8, ::std::make_pair(0, 0), [](::std::pair<int, int> a, int b){return ::std::make_pair((1<<(7+b-a.second))|a.first, a.second+1);}).first).count() == 8)) ::std::cout << queens[0] << queens[1] << queens[2] << queens[3] << queens[4] << queens[5] << queens[6] << queens[7] << ::std::endl; }
Result: 04752613 05726314 06357142 06471352 13572064 14602753 14630752 15063724 15720364 16257403 16470352 17502463 20647135 24170635 24175360 24603175 24730615 25147063 25160374 25164073 25307461 25317460 25703641 25704613 25713064 26174035 26175304 27360514 30471625 30475261 31475026 31625704 31625740 31640752 31746025 31750246 35041726 35716024 35720641 36074152 36271405 36415027 36420571 37025164 37046152 37420615 40357162 40731625 40752613 41357206 41362750 41506372 41703625 42057136 42061753 42736051 46027531 46031752 46137025 46152037 46152073 46302751 47302516 47306152 50417263 51602473 51603742 52064713 52073164 52074136 52460317 52470316 52613704 52617403 52630714 53047162 53174602 53602417 53607142 57130642 60275314 61307425 61520374 62057413 62714053 63147025 63175024 64205713 71306425 71420635 72051463 73025164
eight queen puzzle?
Honorablecon
Honorablecon
http://swifttopia.com/6gT9
Anonymous
Honorablecon
Any adless links?
That's an mega link shorten by adf.ly
Anonymous
That's an mega link shorten by adf.ly
Use kutt.it or bit.ly or something .. adf.ly is annoying
Honorablecon
Ok..
Anonymous
Ok..
Stop sending spam
Honorablecon
That's not spam
Anonymous
That's not spam
Share the mega link
Anonymous
Not from another webpage
Honorablecon
https://mega.nz/#F!lfRgRRhS!54VcfAmGB3MaAduB2R9FVw
Honorablecon
Ok.
What does 0x0a mean at the end of each binary file?
EOF tag?
Anonymous
seems to be new line
many
0a is a newline character
Anonymous
Thx
Worth adding as C in "learn"?
many
And EOF is not a character
seems to be new line
u r right, nl -> new line
And it seems that the last 0x0a is not counted in size tag of this file.
Anonymous
سلام
Anonymous
سلام
English please
Eyobed
Can anyone show me how to input music in my project
Compilation
Hey I am creating a chess game in c++ and i want to make it a multiplayer game Someone in the group pointed out for using or applying the TCP/IP i searched alot but there is no good resource that i can understand how things are going and what is the logic behind it
Compilation
Can someone help me understanding how to upfate the chess board and transfer the data between the two computers
Compilation
I may start by making it a multiplayer game on the same computer as i have seen in some videos
Compilation
I guess it could be easier this way
A
/warn
Compilation
Yeah you can check it from that link https://youtu.be/TSkjy7387RU But its written in java i guess
Anonymous
👌👍
Liam
What does 0x0a mean at the end of each binary file?
The statement doesn't hold. $ cat hello.cc int main() { return 0; } $ g++ hello.cc $ xxd ./a.out | tail 000025a0: 6e65 5461 626c 6500 5f49 4f5f 7374 6469 neTable._IO_stdi 000025b0: 6e5f 7573 6564 005f 4954 4d5f 7265 6769 n_used._ITM_regi 000025c0: 7374 6572 544d 436c 6f6e 6554 6162 6c65 sterTMCloneTable 000025d0: 005f 5f64 6174 615f 7374 6172 7400 5f5f .__data_start.__ 000025e0: 544d 435f 454e 445f 5f00 5f5f 6473 6f5f TMC_END__.__dso_ 000025f0: 6861 6e64 6c65 005f 5f44 544f 525f 454e handle.__DTOR_EN 00002600: 445f 5f00 5f5f 6c69 6263 5f63 7375 5f69 D__.__libc_csu_i 00002610: 6e69 7400 5f5f 6273 735f 7374 6172 7400 nit.__bss_start. 00002620: 5f65 6e64 005f 6564 6174 6100 6d61 696e _end._edata.main 00002630: 005f 696e 6974 00 ._init.
Anonymous
/welcome on
Anonymous
/cleanwelcome on
Anonymous
Now no one should complain
Anonymous
Btw, almost 2k
Anonymous
😂
I forgot to add -b option when opening a binary file.😅
Anonymous
https://www.geeksforgeeks.org/static-and-dynamic-scoping/
Liam
https://www.geeksforgeeks.org/static-and-dynamic-scoping/
Dynamic scope makes name resolving more complicated.
Anonymous
Is there any other channel/group of C Programming ?
correctmaninwrongplace
im in class of language processors, the access link in the stack of calling is beggining to be so bored
Anonymous
/cpp_clang@rextester_bot
Anonymous
/cpp_clang
Anonymous
/cpp_clang@rextester_bot
Ok, give me some Cpp_clang code to execute
Anonymous
/cpp_clang@rextester_bot