Ludovic 'Archivist'
Any thoughts on gitea?
It is simple and works well (even though I have to update my instance, the 2 years uptime is a bit too much)
J
Thanks
Ludovic 'Archivist'
Linus doesn't mind OOP, what he doesn't like is hidden abstraction
Azhar
How can i change double to string my vertual function
三体183号
Finally found a group with a good environment
Angelo
Hello guys someone can help me with a simple c code?
Danya🔥
Hello guys someone can help me with a simple c code?
No one is going to write you a solution for a problem
Jojo
A simple like hello world #include <studio.h> Int main{ Pprintf("hello world"); }
Angelo
Basically i have two functions, the first one is a function that depends on two variables (z,y) and it's a straight function+ a parabola and when I increase the y the angle of the straight line descrease and the second function is only one variable with y. Basically i want to write that along the y axis i have the vector field of the function of one variable and along the z axis i have the vector field of the function of 2 variable.
Jojo
😐
Bit rusty
Peace
Why there is a type conversion error ?? And how to solve it ?? Error says : no viable conversion from '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char>>, std::__cxx11::basic_string<char>>::value_type' (aka 'std::__cxx11::basic_string<char>') to 'int' vector<int> v1{1,2,3,4}; int v1_size=sizeof(v1)/sizeof(v1[0]); string str=""; for(int i=0;i<v1_size;++i){ str+=static_cast<string>(v1.at(i)); }
Robert
you can't Transfer int to string here
Robert
If you want to print these int as string or something like that,you can use to_string function
Robert
str+= to_string(v1.at( i ))
Alviro Iskandar
yeah, should be int v1_size = v1.size();
Alviro Iskandar
or size_t v1_size = v1.size(); to be precise
Robert
So this error is not because static_cast rather than v1_size here?
Anonymous
So this error is not because static_cast rather than v1_size here?
No that is an error as well. He will get a compiler error for that. But the error that I mentioned is a logic error that the compiler may not be able to catch.
Anonymous
or size_t v1_size = v1.size(); to be precise
It should be std::vector::size_type actually. This is where using auto helps
Anonymous
Interested contact me.
Anonymous
Hello
MᏫᎻᎯᎷᎷᎬᎠ
Hello
Hello
Anonymous
I'am beginner, please can you send me execises.
Anonymous
C
Anonymous
Programming
MᏫᎻᎯᎷᎷᎬᎠ
I'am beginner, please can you send me execises.
The group is majorly directed towards answering questions, not teaching or practicing stuff But you can check out website called codewars, it has plenty
Anonymous
👍
Anonymous
Hey does anyone prefer c++98 to this modern junk
Евгений
Hey does anyone prefer c++98 to this modern junk
Come on, cpp brother)) no time for this. Can do better job with C++20. 😋
Madhav
Why is my code showing std::outofrange and not running my functions? I tried searching on google but because I m a complete beginner so i couldn't understand it
Madhav
#include<iostream> #include<string> using namespace std; class binaary{ private:string s; public: void read(void); void check_binary(void); void complement_num(void); void display(void); }; void binaary :: read(void){ cout<<"input your num"; cin>>s; } void binaary :: check_binary(void){ for(int i=0; i<= s.length(); i++){ if(s.at(i) != '0' && s.at(i) != '1'){ cout<<"not a valid binary format"; exit(0); } } } void binaary :: complement_num(void){ for(int i=0; i<= s.length(); i++){ if(s.at(i) == '0'){ s.at(i) = '1'; } else{ s.at(i) = '0'; } } // cout<<"your complement number is"<<s; //this wont return your s i have tried so we use display function } void binaary :: display(void){ cout<<"displaying your binary num"; for(int i = 1; i<= s.length(); i++){ cout << s.at(i); } cout<<endl; } int main(){ binaary g; g.read(); g.check_binary(); g.complement_num(); g.display(); return 0; }
Madhav
This is my code
Alviro Iskandar
It should be std::vector::size_type actually. This is where using auto helps
ah yeah, but i believe it's an alias of size_t, tho not a guarantee, could be implementation defined
Danya🔥
Yes..?
The problem is here
Danya🔥
Think about it
Madhav
Umm.. Ok sir.. I will try
Madhav
But the online tutor had the same code... His code ran mine didn't
Danya🔥
If you'd use a range based for loop or standard C++ algorithms, there wouldn't be any problem
Alviro Iskandar
sometimes it happens to work by luck
Danya🔥
it must be undefined behavior
It's not an undefined behavior
Danya🔥
He used at member function
MᏫᎻᎯᎷᎷᎬᎠ
Hey does anyone prefer c++98 to this modern junk
Modern C++ is waaay better than 98
Anonymous
Modern C++ is waaay better than 98
Modules. So you want c++ to be like python now? Ok yeah i get you..
Anonymous
Templates are turning complete. You can write a parser using them
MᏫᎻᎯᎷᎷᎬᎠ
Templates are turning complete. You can write a parser using them
How about constexpr? In terms of performance...
J
Modules. So you want c++ to be like python now? Ok yeah i get you..
You do know why modules are preferred(modern languages like Rust in general) over header files right?
Dima
the c++23 standard should be as a different language lol imo
MᏫᎻᎯᎷᎷᎬᎠ
the c++23 standard should be as a different language lol imo
Well they just adds another load Idc crap
Dima
c++++ maybe
MᏫᎻᎯᎷᎷᎬᎠ
As always They shouldn't name it C++ anymore
MᏫᎻᎯᎷᎷᎬᎠ
Maybe it's right, we should divide the language into seperated standards
Dima
hard times create strong programmers strong programmers create weak languages which are being used by weak programmers weak programmers create hard times
Anonymous
Which app can i used for coding c
Dima
its cyclic so idc
Anonymous
You do know why modules are preferred(modern languages like Rust in general) over header files right?
There are many ways to design programming languages. You can take the kitchen sink approach and have a million different features i.e c++20 or you can start with a simple base like c++98 and build up more complex tools as you need them
Anonymous
An ide
Which type
MᏫᎻᎯᎷᎷᎬᎠ
Yeah, but life is short lol
The language is being abandoned Rust is taking over I've seen a lot of programmers turned to Rust
MᏫᎻᎯᎷᎷᎬᎠ
I really wish if we have that edition-like feature in C++ It would be cool
J
Which type
Any C/C++ ide. In windows, VS Studio. If you are comfortable with text editors, then VSCode
MᏫᎻᎯᎷᎷᎬᎠ
Rust has an ugly syntax and is too verbose like your c++20
Nope Checkout the pattern matching Its creative ownership paradigm
J
The language is being abandoned Rust is taking over I've seen a lot of programmers turned to Rust
Depends. Since in my knowledge, most Rust programmers are usually blockchain Dev's for some reason.
J
Lol i said android i dont have pc
You can use vim + Termux. Use clang as the compiler(or gcc)
MᏫᎻᎯᎷᎷᎬᎠ
I'm not a Rust Dev, I really would love for C++ to get over from its dirty hole, but the committee just don't get it
MᏫᎻᎯᎷᎷᎬᎠ
I'm not a Rust Dev, I really would love for C++ to get over from its dirty hole, but the committee just don't get it
They just keep adding overloads of features just to fix some stupid design decisions