Sidharth Singh
I've set an target of 2 months from now.
Anshul
For leaning c++ or c++ with data structures
Sidharth Singh
Sidharth Singh
Madhav
I need apps for smart phone
I have already told you... Why are doing this again... What I have told is already enough.. If u want to learn c++
Anonymous
and i also have to delete first element after moving it to the back
You want a rotate left operation. But unfortunately bitset doesn't support such operations. If you need it, you will have to either "do a linear scan and move the bits one by one I guess" or "convert the bitset into a string and do the manipulations on the string and convert it back to a bitset". I can't tell you which would be better without any performance testing. But from the code's point of view, the second method would be more easily understood.
Emirlan
Emirlan
I think i will try to implement the second approach🤔
shriman_deepak
Given a K number, determine the smallest power of 2 which is bigger than K.
shriman_deepak
Anonymous
Anyone please.. just give me a hint
Look at the bits in the number. The smallest power of 2 greater than a number would have a 1 bit at the first 0 bit in the given number and the rest of the bits would all be 0
shriman_deepak
Anonymous
Sorry i didn't understand 🥲
If number is 5, the bits in it are 0101. So you want to return 1000. If number is 32, the bits are 0100000, then you want to return 1000000. This can be done easily by bit manipulations.
Typing...
How can I copy a integer value to another
Dr
Dr
If its a result, store it in a temp variable and call that variable
Typing...
I can't because it is an array in which I have to store the value.
Dr
Typing...
100
Dr
You can copy it by looping it and indexing it
Mickey🕷
Evaluate the following expressions
i) 2>4 && (7<=8) || !(4);
ii) int (3.0)*4/6+6;
iii) ('A' % 2) == 0;
Can I get the answers and explanation on how you reach those answers.
artemetra 🇺🇦
does strlen exlude the null terminator? because in the code i'm reading right now i see a lot of strlen(<str>) + 1, or is it for a different reason?
Ni
A quick question:
std::vector<int> vec{1,2,3,4,-1,-2,-3};
auto res = std::binary_search(vec.begin() + 4, vec.end(), -1);
std::cout << res << "\n";
why the code gives 0
Anshul
Anonymous
A quick question:
std::vector<int> vec{1,2,3,4,-1,-2,-3};
auto res = std::binary_search(vec.begin() + 4, vec.end(), -1);
std::cout << res << "\n";
why the code gives 0
You do realize that -1,-2,-3 is not sorted as is required by binary search. It expects the elements to be in ascending order (actually not required to be sorted) while you have them in descending order.
Anonymous
Ni
thanks for your help!
Anonymous
Anshul
Shahar
What's the inherent problem in developing an interpreter-like for C/C++?
We can develop a program maintaining a source code file which is filled in by the interpreter user.
Every time the interpreter user presses Enter, the interpreter compiles and runs the source/binary respectively - if there is an output which is not some error due to the possibility the user didn't finish to write his routine.
+
guys when I want to create a bunch of folder (that also have subfolders) with std::filesystem::create_directories its some times fail and say The filename or extension is too long. its right, because im trying to create a folder with like 14 subfolder, how can I do it?
Lxjxjxhks
Umm, I installed the command line tools in my Mac using this command arch -x86_64 /bin/bash -c "$(curl -fsSL http://bit.ly/homebrew_techdecode)" and then I did not installed any compilar, but whenever I run a c program in vscode, it shows that it's compiled by a gcc compilar, but I want to use clang and it already is installed idk how but when I used the command clang --version it shows installed and the version. So if now, I want to use clang to compile c program instead of gcc, how do I do it?
Anonymous
Thanks for inviting me
Anonymous
Shahar
Anonymous
Anonymous
Slow - probably.
Pointless - why?
Pointless because it is slow. The C++ standard committe has already proposed a REPL (it works differently from what you suggested above and has limited functionality) and it is yet to be approved AFAIK.
+
Shahar
artemetra 🇺🇦
Anonymous
Anonymous
i did loop up on cplusplus.com but found no info on that, thank you though!
Use cppreference.
But I just searched for the cplusplus definition - https://www.cplusplus.com/reference/cstring/strlen/
And it clearly mentions this in the first line
"The length of a C string is determined by the terminating null-character: A C string is as long as the number of characters between the beginning of the string and the terminating null character (without including the terminating null character itself)"
So not sure what you read.
+
Anonymous
this is tested, but still not work https://godbolt.org/z/4ahqd5M1z
You are using Windows. Windows doesn't allow file lengths more than 260 characters and Windows checks this from the root. So even if you are not going to refer to the sub directories from the root, Windows still doesn't allow creating them. Try limiting your folder names to 2 or 3 characters.
Anonymous
What's the idea behind their suggestion?
It is a very limited feature set tool which allows basic things like constexpr and consteval functions and allows you to do some limited prototyping. These are things that the compiler can work with without invoking a linker.
Shahar
+
Anonymous
Shahar
Shahar
Shahar
Don't know if it's right to bother the committee for this one
D
Guys
D
Please send me group about java
Alex
array<char, 5> d = {"sdfd"};
compiled
vector<array<char, 5>> s1{{"asdf"}};
not compiled
error: no matching function for call to ‘std::vector<std::array<char, 5ul> >::vector(<brace-enclosed initializer list>)’
vector<array<char, 5>> s1{{"asdf"}};
how to fix?
Ludovic 'Archivist'
Ludovic 'Archivist'
This is literally the software that generated the picture of a black hole for the earth telescope project and the analysis for detecting the Higgs boson at LHC
Anonymous
Alex
It should compile fine.
I found issue. it compiles only from gcc 11.1(std=c++11 is used everywhere)
for older compiler
vector<array<char, 5>> s1{array<char,5>{"asdf"}}; works
Ludovic 'Archivist'
I think that the forwarding of the initializer list may have been the problem
Anonymous
Anonymous
Shahar
Knights
Good evening
Please I get this error statement...”the range-based for statement requires a suitable begin function and none was found” in my code
This is the code
double ScoresTotal(double testScore[], int numTests)
{
double total=0;
int numTests=4;
double testScore[numTests];
for(auto score : testScore)
{
total+=score;
}
}
Anyone to help fix this error?
Please🙏🏿
Dima
hmm wtf
Pavel
Knights
Pavel
How do I know the c++ version I’m using
You provide the version to the compiler when you build the app, othervise it uses its defaults.
You can try to find your compiler version and google what is the latest C++ version that it supports and how to set it during compilation.
Knights
Anonymous
T3
Am new to c++,,can someone help me I sorting this out,,I need to arrange in descending order but it's like I got an error in it I can't solve,,any help
Anonymous
T3
#include<iostream>
using namespace std;
int main()
{
int n,i,j;
int arr[]={4,7,9,3,5,6};
int temp=0;
printf("%d",arr[6]);
for( int i=1;i<n;++i){
for ( int j=i+1;j<n;++j){
if(arr[i]<arr[j])
arr[i]=arr[n];
{ temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;}}}
for( int i=1;i<n;++i){printf("%d",arr[i]);}
return 0;
}
T3
#include<iostream>
using namespace std;
int main()
{
int n,i,j;
int arr[]={4,7,9,3,5,6};
int temp=0;
printf("%d",arr[6]);
for( int i=1;i<n;++i){
for ( int j=i+1;j<n;++j){
if(arr[i]<arr[j])
arr[i]=arr[n];
{ temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;}}}
for( int i=1;i<n;++i){printf("%d",arr[i]);}
return 0;
}
This is it,,sorry I never sent it,,