Anonymous
any one have idea how i can write this?
Anonymous
in c programming
Otumian
Using nested loop and selection structure, print the following shape on the screen by repeating printf(“%d”, x) where the value of x could be 0 or 1. 01010 01010 01010 01010 01010
It is good you have a problem. Try printing x first. then try multiple x using a loop. finally, try a loop in a loop and see
Yatin 🥢
Can someone please tell me which is the best book for learning C?
Diego
/get cbook
Diego
Check that out @DJ_GIRL
Prince Of Persia
Using nested loop and selection structure, print the following shape on the screen by repeating printf(“%d”, x) where the value of x could be 0 or 1. 01010 01010 01010 01010 01010
for(int i = 0;i < 5;i++){ for(int j = 0;j < 5;j++){ int x = j%2; printf("%d",x); } printf("\n"); }
Gustavo
/get cppbookguide
H
guys who is checking ISO20 (2a) these days???
Anonymous
@hadiiiiiiiiiiiiiiiiiiiii Moved the discussion to offtopic chat
Anonymous
This is the link to join
H
What is that?
new Standard for c++ (newst one)
Anonymous
new Standard for c++ (newst one)
So what's the question?
Anonymous
new Standard for c++ (newst one)
Use C++20 to call it, not "ISO 20", no one calls it like that
H
No question I found really good featuure(new) that is so cute , and can make your code portable than old coding ... go check <version>.
Anonymous
doesnt matter.
It does matter
Anonymous
If you want to be understood
H
It does matter
I dont care.
Anonymous
H
Lol Feature testing macros are old
nope , its not just testing macros ... -_- you saying like this «consexpr is old topic» but if you check in new c++ (c++20😁) you will find new feature of this keyword 😐 like constexpr for destructure , for constructor 😐
Anonymous
I will 🙏
I'm waiting
Merve
hi all, did u try before uart interrupt?
Merve
ı cwant to read receive data
Merve
can u help me pleaase
H
I'm waiting
#include <iostream> #include <version> #if __has_include(<format>) # include <format> //!STL #elif __has_include(<fmt/format.h>) # include <boost/format.hpp> //!Boost #endif #if __cpp_lib_format using format = std::format; #else using format = boost::format; #endif int main () { std::cout << format("writing %1%, x=%2% : %3%-th try") % "toto" % 40.23 % 50; } where you can find this feature before c++20 ?
H
1) __has_include is since C++17 2) std::format is a derivative of libfmt, not Boost.Format
oops , your right mate😂😂😂 but «feature testing» all has added to this for language support like : __cpp_lib_jthread (c++20)
Thor
Write a program that reads in from the user an integer (num) between 1000 and 9999. Then it prompts the user to enter an integer (d) between 0 and 9 and a character (ch). Your program should replace the second and the last digit in num with d and it should display the character that precedes (ch) followed by the number after the change and then the character that comes after (ch). Use the division and modulus operators to extract the digits from num. Anyone can help me in this?
Anonymous
. Write a ‘Basic Guessing Game’ C program. In the program, identify whether the integer value entered by the user is match to the value 666. The user has 3 chances to guess. The program will terminate after the 3rd wrong attempt or when the user input is 666
Anonymous
any have idea this how i can write it?
Anonymous
any have idea this how i can write it?
Function, decisions, looping, then playtime.
Parv
Hey
Parv
Help me to learn c language
Parv
Vedios ???
Mihai
learn how to learn by your own. Read books, search on Wikipedia, make pull requests on githubs, check Youtube videos.
Damo
can anyone send me kernel device driver handwritten notes..im ready to pay amount also
Otumian
Help me to learn c language
If you want to learn enough c, videos.. but if you want to learn c to feel like you'd go bald on weekdays, books.. books my friend..
دموع
peace upon you
دموع
One helps me by answering questions
Amu
can anyone help me with a small part of my c assignment?
Amu
if you know c
Amu
i tried to solve it for a long time but i’ve been stuck for a while now
Avocado
just write what u need
Pavel
What is wrong with this code? It crashes for me on SIGSTOP if I run the app under debugging with GDB (compiled with gcc). Crash is on the created thread somewhere in non-symbolized code (allocatestack.c). auto thread = std::thread([]{}); thread.join();
Ludovic 'Archivist'
can anyone send me kernel device driver handwritten notes..im ready to pay amount also
I can for about 4 hours of work which would be about 90€ if I am being a nice person, also probably not the place to ask
Pavel
I think you should do if (thread.joinable()) thread.join();
Hm, what should I do if it's not joinable at that moment? Spin a loop?
Ludovic 'Archivist'
Hm, what should I do if it's not joinable at that moment? Spin a loop?
Either spin or just wait. I advise the use of this_thread::yield()
Anonymous
If it's detached or a function in the thread is done — it is not
Ludovic 'Archivist'
Ludovic 'Archivist'
False
AFAIK join never cancels
Anonymous
If it's detached or a function in the thread is done — it is not
This is also false A thread is joinable when it wasn't joined or detached, or is not default constructed
Anonymous
https://en.cppreference.com/w/cpp/thread/thread/joinable
Anonymous
Hm, what should I do if it's not joinable at that moment? Spin a loop?
Since you speak Russian, I recommend you to watch C++ Lectures from Konstantin Vladimirov — they are really awesome
Ludovic 'Archivist'
This is also false A thread is joinable when it wasn't joined or detached, or is not default constructed
I always forget that join waits, I always expect a try_join or something like that and am always disappointed 😅
Pavel
I expected that join will put the current thread to sleep until the other thread is done, and that I can call join basically at any moment before or after that (but only once) 🤔
Ludovic 'Archivist'
Join busy waits another thread
Is it defined as busy waiting of is it implementation dependent? I'd feel like it should be is it not?
Amu
// Now construct the result from OR'ing (using bitwise-or, | ) together the // following components of the result: // -- the sign bit of the result, shifting into the sign position // -- the lowest 8 bits of the exponent, shifted into exponent position // -- the lowest 23 bits of the mantissa (i.e. removing the 1 in bit 23 position, // since it is implicit)
Anonymous
But it definitely blocks the current thread from execution
Pavel
Still crashes even like this (almost like in example from the cppreference link above, but with yield) auto thread = std::thread([]{ std::this_thread::sleep_for(std::chrono::seconds(1)); }); while (!thread.joinable()) std::this_thread::yield(); thread.join();
Anonymous
while (thread.joinable())
Pavel
while (thread.joinable())
Still the same auto thread = std::thread([]{ std::this_thread::sleep_for(std::chrono::seconds(1)); }); while (thread.joinable()) thread.join(); It feels like it fails to create the thread for some reason