Anonymous
I need a code that says in which index the words in the first file are in the second file, how can I do it, can you give a hint(problem is number of words in the files might be more than a million)
Ralph
Good for you
😂😂😂
Hadaward 'Solly'
Hadaward 'Solly'
if anything i said sounds alien, pick a dictionary
Anonymous
if anything i said sounds alien, pick a dictionary
Nope thanks the only problem is i couldnt find how to read the file which only containing words and seperated whitespaces(without storing it)
Hadaward 'Solly'
string/token comparison tasks require you to store something. I dont follow you.
PaAaAria
#include <iostream> #include <cmath> using namespace std; int main() { double h,k1,k2,g,height; //these are the constants double mass=pow(9.5,-4);k1= 30; k2=40;g=9.8;height=0.43; double dnew,fnew,fh,f0,root,df,d0,d;//these are the changeable variables cout<<"insert the point of origin "<<endl; cin>>d0; { do { //code for calculating the forward diffrenece h=0.01; d=d0+h; f0=(-0.4)*k2*d0+0.5*k1*pow(d0,2)-mass*g*d0-mass*g*height; fh= (-0.4)*k2*d+0.5*k1*pow(d,2)-mass*g*d-mass*g*height; df=(1/h)*(fh-f0); //code for calculating the root by newton-raphson method dnew=d0-(f0/df); fnew= (-0.4)*k2*dnew+0.5*k1*pow(dnew,2)-mass*g*dnew-mass*g*height; if (abs(fnew)<=0.000001) { cout<<"root="<<dnew<<endl; break; } else d0=dnew; } while (fabs(dnew-d0)>=0.000001); cout<<"root="<<dnew<<endl; } return 0;}
Anonymous
Shvmtz
How can i create or generate a c++ project in vscode so that i can build and run as like in visual studio ide ?
Harvey
https://youtu.be/77v-Poud_io
Shvmtz
Check this tutorial guy
Thanks. But actually I got confused about the c++ project structure in visual studio ide. And also, in some GitHub projects they use to have a lot of other directories(or libraries or something i don't know) in their project structure. So, i was thinking of that stuff. But VScode as an editor doesn't generate a project structure for you. So, i was asking if VScode too can generate/create a project structure like that ?
Hadaward 'Solly'
数学の恋人
and then just smash it in C if you want
Shvmtz
It's you who create a structure
I've heard of cmake several times. And a lot of people use cmake in their projects. It'll great if you can give me an idea of cmake. Is it more helpful in some way ?
Shvmtz
The only build tool system which is harder to understand than the languages it builds
Is it more helpful ? As a lot of people use it in their projects.
MᏫᎻᎯᎷᎷᎬᎠ
Is it more helpful ? As a lot of people use it in their projects.
Totally yeah, once you figure out how to use it
MᏫᎻᎯᎷᎷᎬᎠ
I'm not that familiar with it But I heard it's turing complete
MᏫᎻᎯᎷᎷᎬᎠ
From where can i learn ?
There is a book I can't remember its name, but it's new, you'll find it out + Cmake has its own documentation website
MᏫᎻᎯᎷᎷᎬᎠ
Welcome
SetPf
Hello guys. Im trying to generate project with CMAKE with custom toolchain (embedded, XC8 compiler) on windows 10. But cmake ignore custom toolchain. It always generate files for MVS. Im tried with -G"Unix_Makefile" and it change behavior, but i still need custom toolchain to execute. The problem also in that is my first cmake project =)
SetPf
The quick guide says, what im only need to add: set(CMAKE_TOOLCHAIN_FILE *path to toolchain.txt*) set(MICROCHIP_MCU *mcu model*) At top of CMakeLists. But in fact, im just getting default generation. And yes, every time before generation, im clean the folder.
SetPf
I would have loved to help you out but I don't use XC8, I use CCS C... more like C.
Its not problem of compiler (up to this point) but toolchain file launch.
Talula
Its not problem of compiler (up to this point) but toolchain file launch.
But I am totally inexperienced with it so can't help you even if I would love to.
Anonymous
int main (void) { int a= 10; a=a++; a=a++ * a--; pf(%d,a) pf(%d,a++ * a--); return 0; }
Anonymous
int main (void) { int a= 10; a=a++; a=a++ * a--; pf(%d,a) pf(%d,a++ * a--); return 0; }
guys I am missing some logic in this question can anybody give their suggestion regarding this
Anonymous
int main (void) { int a= 3,b=4,c=3,d=4,x,y; x=(a=5) && (b=7); y=(c=5) && (d=8); pf("a=%d,b=%d,c=%d,d=%d,x=%d,y=%d\n",a,b,c,d,x,y); x=(a==6) && (b=9); y=(c==6) && (d=10); pf("a=%d,b=%d,c=%d,d=%d,x=%d,y=%d\n",a,b,c,d,x,y); return 0; }
mov $22, %rax
int main (void) { int a= 10; a=a++; a=a++ * a--; pf(%d,a) pf(%d,a++ * a--); return 0; }
it prints 120 and than the product of 121 and 119, but it is packed with errors.
mov $22, %rax
and it's still quite useless
Anonymous
PaAaAria
https://hastebin.com/dofiyutowu.cpp hi, here is the code for calculating the roots of an equation, I used a do-while loop but it doesn't work. It shows me just one root and seems that it doesn't repeat the process. I debugged it but the problem is still unsolved. what's the problem?
Anonymous
http://coliru.stacked-crooked.com/a/afe5fdace16ead6b how can I check if Png has implemented display()
V01D
learn how to indent correctly lol
Luckily it isn't an issue for the c++ compiler, it's just hard to read
olli
http://coliru.stacked-crooked.com/a/afe5fdace16ead6b how can I check if Png has implemented display()
you can't instantiate Png unless all pure virtual functions have been implemented.
Anonymous
:(
Anonymous
how else can i determine if a class overrides a funtion?
Anonymous
would i need like... a function pointer table thing?
olli
Why do you need to see whether a certain class overrides a function? That's against the principles of OOP and hence bad design.
Anonymous
cus i want to be able to decide what callback i should call at runtime based on class information
olli
let the class call the callback as it has (or at least should have) all the necessary information.
Anonymous
eg class Plugin { public: virtual int write(PortUtils2 * in, PortUtils2 * out) = 0; virtual int write(PortUtils2 * in, PortUtils2 * out, unsigned int samples) = 0; virtual int write(PortUtils2 * in, Plugin & mixer, PortUtils2 * out) = 0; virtual int write(PortUtils2 * in, Plugin & mixer, PortUtils2 * out, unsigned int samples) = 0; };
Anonymous
or would i need to do https://gist.github.com/a741fe8ac4b60307763f5d31b202dd69 and have classes override the appropriate functions
Anonymous
then say...
Anonymous
if (plugin.requires_sample_count()) { if (plugin.requires_mixer()) { return plugin.write(in, mixer, out, samples); } else { return plugin.write(in, out, samples); } } else { if (plugin.requires_mixer()) { return plugin.write(in, mixer, out); } else { return plugin.write(in, out); } }
PaAaAria
https://hastebin.com/dedifefiva.cpp this would be better
thank you, but I think the loop isn't working, do you think that the method is calculating the root accurately?🤔
olli
then say...
but what is your question? Where is the callback?
Anonymous
Hi am new here
olli
Hi am new here
don't post those links here or you will get banned (read the rules for more details)
Anonymous
calling a subclass's functions will call any functions that are overriden right? for example Plugin_Type_Mixer * mixer_ = reinterpret_cast<Plugin_Type_Mixer*>(mixer); mixer_->addPort(mixerPortA); and class Mixer : public Plugin_Type_Mixer { /* override addPort */ }
Anonymous
Own code
If it's your own u already know your logic there right?
Roshan
Hello! Can anyone see if my approach is correct for a Question?... NOTE: My program works perfectly.
Roshan
Q-> To find the middle character of a reversed string in a given array of strings in heap and the length of that string.
Roshan
https://paste.ubuntu.com/p/fb9GThYhSF/
Roshan
Sample Input: xyz abc def zyx Output: 3 y
Roshan
https://paste.ubuntu.com/p/fb9GThYhSF/
Ignore the "string reversed;"
Anonymous
How to ignore whitespaces while reading a file with fgets(txt contains only string and whitespaces)
-Bs¬
Sorry for asking. if someone knows android native development Tg groups plz send me link
Deidara
@en_it_chats
Gold mine, thanks
Xudoyberdi