Anonymous
Hmm, didnt buy it, well written bot
Anonymous
Hmm
Rohit
How to parse the string on multiple character "abc][rfd][5][,][."
??
Should yield an array containing;
abc
rfd
5
,
.
Dima
strtok maybe
Dima
make array of these chars ([],.) and check
Dima
in loop
Dima
perhaps using strtok or just non equality op
Jussi
Jussi
Its for multiple single characters
Rohit
No its not
can you write the algo then for above ques
Jussi
Sure
Rohit
Sure
https://ide.geeksforgeeks.org/dXpgeGMuhK
Split this on -1
Rohit
Sure
It's done.. leave it
Jussi
ok
Anonymous
How to hack wifi password
Sharmarke
Anonymous
Kaun sa
Anonymous
App
Anonymous
Photoshop tricks
Anonymous
To photo editing
Anonymous
Aadarshhh
#include<iostream>
using namespace std;
class time
{
int hours,minutes,seconds,hrs1,mins1,secs1,hrs2,mins2,secs2;
public:
void set_time(int hrs,int mins,int secs)
{
hours=hrs;
minutes=mins;
seconds=secs;
}
void get_time()
{
cout<<"**First Time** :"<<endl<<"Enter first time in hour,minutes and seconds : ";
cin>>hrs1>>mins1>>secs1;
}
void next_time()
{
cout<<endl<<"**Next Time** :"<<endl;
cout<<"Enter next time in hour, minutes and seconds";
cin>>hrs2>>mins2>>secs2;
}
void show_time()
{
seconds=secs1+secs2;
minutes=mins1+mins2+(seconds/60);
hours=hrs1+hrs2+(minutes/60);
minutes=minutes%60;
seconds=seconds%60;
cout<<"The time is "<<hrs1<<"hrs "<<mins1<<"mins "<<secs1<<"secs "<<endl
<< "The added time is"<<hours<<"hrs "<<minutes<<"mins "<<seconds<<"secs ";
}
};
int main()
{
time t;
t.get_time();
t.next_time();
t.show_time();
}
Aadarshhh
Aadarshhh
can someone figure out bug in this program
Aadarshhh
Aadarshhh
here's the code
Dima
when I see someone asking how to hack wifi:
Dima
Đăng Lú
U didn't initialize the var t. U just declared it. That's the bug, I assume
Dima
Rohit
https://ide.geeksforgeeks.org/fMpM64RmXe
can someone check this code, it should split on "ma" only but it is getting split on "a" , "m" and as well as "am" character too
Rohit
Aadarshhh
#include<iostream>
using namespace std;
class time
{
int hours,minutes,seconds,hrs1,mins1,secs1,hrs2,mins2,secs2;
public:
void set_time(int hrs,int mins,int secs)
{
hours=hrs;
minutes=mins;
seconds=secs;
}
void get_time()
{
cout<<"**First Time** :"<<endl<<"Enter first time in hour,minutes and seconds : ";
cin>>hrs1>>mins1>>secs1;
}
void next_time()
{
cout<<endl<<"**Next Time** :"<<endl;
cout<<"Enter next time in hour, minutes and seconds";
cin>>hrs2>>mins2>>secs2;
}
void show_time()
{
seconds=secs1+secs2;
minutes=mins1+mins2+(seconds/60);
hours=hrs1+hrs2+(minutes/60);
minutes=minutes%60;
seconds=seconds%60;
cout<<"The time is "<<hrs1<<"hrs "<<mins1<<"mins "<<secs1<<"secs "<<endl
<< "The added time is"<<hours<<"hrs "<<minutes<<"mins "<<seconds<<"secs ";
}
};
int main()
{
time t;
t.get_time();
t.next_time();
t.show_time();
}
what is really problem in this code
Jussi
Jussi
if you give it "ma" as delims, it will use both "m" and "a" as delimeters
Dima
it will be initialized
Dima
then going to constructor
Jussi
if you want to delim only by having both "ma", you pretty much have to go thru the char array by hand
Jussi
while(*str != 0)
{
if(*str== 'a' && *(str-1) == 'm')
{
// str-2 is now the last before "ma"
}
str++;
}
Dima
well it can be constructorless but it will be initialized
Dima
and later destroyed on scope exit
Dima
local object
Dima
just try it
Dima
its not like c# or whatever style
Jussi
god damn my code sucks, now it should be ok
Rohit
Jussi
yeah sure
Aadarshhh
https://paste.ubuntu.com/p/s9Yr44VR6S/
Sharmarke
Rohit
yeah sure
Let me know when that programs work
Đăng Lú
I think that is where the bug goes. The compiler reports err that doesn't mean it will tell us exactly where to find.
Dima
yeah but if theres some initialized data in method it will be ok
Dima
but there are none
Dima
🤔
Đăng Lú
I'm away from my computer, so I wonder if anyone could help me test my theory?
Aadarshhh
hmm anyone there?
I'm finding hard to understand it
Aadarshhh
https://ide.geeksforgeeks.org/oKFQCkRt60
Rohit
Jussi
yeah
Jussi
there are still flaws
Jussi
but maybe that gets you going
Rohit
yeah
flaws what?? give link of code?
Jussi
Jussi
well there is no flaw if the delimeter is 2 chars, but if it was 3 chars, then there would be possible read overflows
Đăng Lú
Rohit
Jussi
yep
Jussi
but I guess you can figure it out yourself
Đăng Lú
Đăng Lú
Line 34