Anonymous
then the output
without space
ab
with space
a b
S.
Isn’t it what you need?
Anonymous
I also just started c++.dont scare me😅😅🤣🤣
Anonymous
Anonymous
S.
😅 But I don’t see any problem with this code ( except for coding style and some typos
Anonymous
Anonymous
S.
show us the error
Anonymous
Maybe some error with compiler
Anonymous
Ohhh come on somebody gonna help or not?
Anonymous
I can't show you the error right now because I'm on ttavel
S.
We’re trying to help
Anonymous
*travel
Anonymous
If you can't show us error.how could we help,
Anonymous
?*
Anonymous
I did not bring my laptop
Anonymous
i remember that symbol3=" "; is error
S.
😑 So you figure out the problem by yourself
S.
congrats
S.
should be symbol3 = ' ';
Anonymous
but how?
S.
symbol3 is only a char
S.
So you can’t assign a literal c-style string to it
Anonymous
Anonymous
yup
Anonymous
is it using string or what?
S.
S.
cout can accept many types of variables
S.
symbol3 is a char
klimi
Welcome
Heenim
Heenim
can anybody help me with this?
Heenim
the error shown is "Illegal line end in string literal"
John
No
Dima
That’s not even cxx
Heenim
yeah.. it's java
S.
Your " do not match
Anonymous
int main()
{
vector<string> v;
string x;
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>x;
v.push_back(x);
}
for(int i=0;i<n;i++)
{
x=v[i];
replace(x.begin(),x.end(),'a','0');
replace(x.begin(),x.end(),'e','1');
replace(x.begin(),x.end(),'i','2');
replace(x.begin(),x.end(),'o','3');
replace(x.begin(),x.end(),'u','4');
}
Anonymous
Why any string is not convert to number
Anonymous
As I want
Anonymous
int main()
{
vector<string> v;
string x;
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>x;
v.push_back(x);
}
for(int i=0;i<n;i++)
{
x=v[i];
replace(x.begin(),x.end(),'a','0');
replace(x.begin(),x.end(),'e','1');
replace(x.begin(),x.end(),'i','2');
replace(x.begin(),x.end(),'o','3');
replace(x.begin(),x.end(),'u','4');
}
In this code??
Heenim
Ohh yeah
Mat
Heenim
Heenim
I Googled it but the answer is different
Anonymous
*aeiou
Heenim
The problem is just a typo
Anonymous
Code should give me 01234 but it gives same as I input aeiou
S.
Anonymous
I have share only certain part of my code
Anonymous
int main()
{
vector<string> v;
string x;
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>x;
v.push_back(x);
}
for(int i=0;i<n;i++)
{
x=v[i];
replace(x.begin(),x.end(),'a','0');
replace(x.begin(),x.end(),'e','1');
replace(x.begin(),x.end(),'i','2');
replace(x.begin(),x.end(),'o','3');
replace(x.begin(),x.end(),'u','4');
}
for(int i=0;i<n;i++)
{
x=v[i];
for(int j=0;j<x.size();j++)
{
cout<<x[j];
}
cout<<endl;
Anonymous
Heenim
Mat
int main()
{
vector<string> v;
string x;
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>x;
v.push_back(x);
}
for(int i=0;i<n;i++)
{
x=v[i];
replace(x.begin(),x.end(),'a','0');
replace(x.begin(),x.end(),'e','1');
replace(x.begin(),x.end(),'i','2');
replace(x.begin(),x.end(),'o','3');
replace(x.begin(),x.end(),'u','4');
}
for(int i=0;i<n;i++)
{
x=v[i];
for(int j=0;j<x.size();j++)
{
cout<<x[j];
}
cout<<endl;
Are you sure about x = v[i]?
Anonymous
Anonymous
I mean if my Input is 3 aeiou u o
Then o/p should be 01234 4 3
S.
He means, that’s a copy?
S.
If you just copy a string to x and modify x, then nothing is modified in v[i]
Anonymous
Mean
Anonymous
Buddy will ellobrate and how to correct it
Anonymous
Ok I got it I have changed in x then I have to copy that in vector again and delete previous one right
Anonymous
?
Mat
That's a solution, yeah
S.
Why not use a reference
S.
Like for(int i = 0; i<n; i++)
{
string& x = v[i];
replace(x.begin(),x.end(),'a','0');
replace(x.begin(),x.end(),'e','1');
replace(x.begin(),x.end(),'i','2');
replace(x.begin(),x.end(),'o','3');
replace(x.begin(),x.end(),'u','4');
}
Anonymous
Like for(int i = 0; i<n; i++)
{
string& x = v[i];
replace(x.begin(),x.end(),'a','0');
replace(x.begin(),x.end(),'e','1');
replace(x.begin(),x.end(),'i','2');
replace(x.begin(),x.end(),'o','3');
replace(x.begin(),x.end(),'u','4');
}
Thx buddy
Anonymous
I haven't think this for😅
Anonymous
How to reduce time complexity of this
Anonymous
https://ideone.com/FsiopM
Anonymous
Any idea?!!!
Anonymous
Anonymous
?