Xudoyberdi
I am also not pro
#offtopic let's go to off topic group
Alishba
https://pastebin.pl/view/68fd867a This code is supposed to take a 4 digit number and break it into individual digits and then display the table of last two digits, taking first two digits as starting and ending point of that table. But in my case, only 1st table is being displayed and second for loop is not being executed. Why is this code not displaying two tables? Can someone please help me?
Tushar
Considering following program code, which one of option is correct - main( ) { char *p = "hello world"; p[0] = 'H'; printf("%s", p); } a. Has Runtime error. b. Would output "Hello world" c. Has Compile error d. Would Output "hello world"
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
[xcb] Unknown sequence number while processing queue [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called [xcb] Aborting, sorry about that. main: xcb_io.c:269: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed. how can i fix this? its working in manjaro KDE but not in arch awesome wm is this problem of xorg or C? works in dwm and bspwm though
SHAISTA
//sieve of eratosthenes #include<iostream> using namespace std; void primeSieve(int n) { //int *array{ new int[length]{} }; syntax of initialize a dynamic array to 1 or 0 int *A{new int[n+1]{1}}; for(int i=2;i*i<=n;i++) { if(A[i]==1) { for(int j=i*i;j<=n;j=j+i) { A[j]=0; } } } for(int i=2;i<=n;i++) { if(A[i]==1) cout<<i<<' '; } cout<<endl; } int main() { cout<<"enter number till that you want to print prime numbers"<<endl; int N; cin>>N; primeSieve(N); return 0; }
SHAISTA
anyone please check where i m wrong
SHAISTA
i m not getting output after entering input
labyrinth
Because in case of the map, initializer_list can help to pass objects that will be stored in the container, but these will not affect type as far as I remember. And pair and tuple are made with templates so their type depends on every element of the constructor
Sorry for late reply since i was out and the confusion in my illustration. it is a different kind of question about the usage of such syntax in template programming. as far as intuition, one can use template<> struct MyStruct<MyType> to customize the implementation of user defined class (which is similar to what std::hash did for hashing of basic types) , under the base definition of template<class T> struct MyStruct{}
labyrinth
However, I came across this pattern of definition but find it hard to understand the usage. template<class T> struct MyStruct<T*>
N
Hello everyone
N
while (1){ unsigned gpio=PORTD; if (gpio & (0x01|0x02|0x04)){ PINB=1; } }
N
while (1){ uint8_t gpio=PIND; uint8_t out=0; if (gpio & (0x01|0x04)) out|=2; if( gpio&0x2 ) out|=1; PORTB=out; }
N
Can you write those codes in assembly
N
I haven't confidence with this language,It would be better for helping me
labyrinth
the exact same definition can be seen here https://en.cppreference.com/w/cpp/utility/hash
labyrinth
but i tried to look at the functional source code, in which i cannot find the relevant definition
Gulshan
/get cbook
Pavel
the exact same definition can be seen here https://en.cppreference.com/w/cpp/utility/hash
Can you point it out, I'm not very concentrated right now to find it. I see ones with template<>, these are template specialisations. By the way, the code you've sent looks like partial specialization (but it really hard to remember how and in what order the parameters go when you're not writing it every day, so I'm not sure).
Khan
#ask How to fix this problem in VSCode? gcc.exe: Angka: No such file or directory gcc.exe: 1-500.c: No such file or directory gcc.exe: 1-500: No such file or directory gcc.exe: no input files
Anonymous
You fix this problem by changing current directory in your console
Samandar
How long does it take to learn C #
Anonymous
How long does it take to learn C #
/ban sorry mate, but it is forever for you since you can't read
amit
/warn
Gnostic Trades |
I'm want to start competitive programming and I know C already
Roshan
There are 187 code based questions
Anonymous
Download an app called Dcoder
It is not available for Windows
Gnostic Trades |
It is not available for Windows
I just want to start working with it
Gnostic Trades |
And learn more concept along with implementation
Gnostic Trades |
What should I prefer?
Manav
What should I prefer?
What do you mean?
Gnostic Trades |
What do you mean?
I mean I want to start competetive programming in c++
Gnostic Trades |
I mean I want to start competetive programming in c++
Should I start learning with book or youtube tutorials?
Vitalii
Sorry, can anyone give me the idea how to do next thing: find most frequent element in char array. I google it, but codes from sites don't really work as they should...
Manav
I mean I want to start competetive programming in c++
Ah, start with discrete mathematics then DSA stuff.
Gnostic Trades |
Ah, start with discrete mathematics then DSA stuff.
Yes, can you give me more info please 🙏
Manav
Should I start learning with book or youtube tutorials?
DSA there is a YouTube series by mitopencourseware.
Manav
I know c
How much do you know it? Just knowing the language syntax and featutes isn't enough.
Gnostic Trades |
DSA there is a YouTube series by mitopencourseware.
But firstly I have to learn c++ basics? Right?
Manav
I know till pointers and recursion
You don't qualify to say you know C then.
Gnostic Trades |
Not really
But it's said that it's good to do competitive programming in c++. Isn't it?
Gnostic Trades |
You don't qualify to say you know C then.
But now I want to learn c++ amd continue my competitive programming in c++
Manav
But now I want to learn c++ amd continue my competitive programming in c++
Well if you want to learn C++ just for the sake of doing competitive programming. I wouldn't stop you but you could just do everything you can in C++, in C
Gnostic Trades |
The more you know the better
Isn't it a good idea to leave c which I left 6 months ago and have a fresh start with c++??
Manav
What about those c++ libraries?
All those libraries you find will most probably have a port to C, except maybe boost libs, idk. Lemme check
Manav
Isn't it a good idea to leave c which I left 6 months ago and have a fresh start with c++??
It doesn't matter. DSA and mathematics which you actually need for competitive programming are not language dependent.
Manav
The speed and ease of writing of the program in those language would be, but that's a different matter
Gnostic Trades |
Gnostic Trades |
Should I continue with c where I left off or have a fresh start with c++?
Manav
I'm really confused now. Please help me to decide what should I prefer?
As far as language is concerned do whatever you wish, if you want to learn C do so, if you want to start with C++ do so. As for competitive programming, learn DSA and discrete Mathematics
Manav
That's also a factor counted in the cp
C and C++ are nearly the same, when it comes to speed. Infact C programs would fare slightly better than C++ most of the times.
Manav
But speed is also dependent on how you code so
dj
C and C++ are nearly the same, when it comes to speed. Infact C programs would fare slightly better than C++ most of the times.
still c++ would be better for competitive programming i guess because of built in library support
Manav
Just last question. In which of these language it's easier to write code?
Between C and C++? Both have the same difficulty level
Gnostic Trades |
Between C and C++? Both have the same difficulty level
Then why almost 75% competitive programmer are using c++?
dj
C has a lot of math libraries.
ah i am not familiar :)
Manav
Then why almost 75% competitive programmer are using c++?
Because it's more modern and popular
Manav
I guess "modern" is not a good word because it gives you the illusion that it's better, which isn't. Javascript is modern too lol
D
hello
D
am new here