Maksim
Anonymous
And try to cover STL (Geeksforgeeks)... it would make you more fluent
Anonymous
Hello
عزة
Anonymous
Stat c++
Anonymous
Plz stat
Dima
Dima
dir.h?
Dima
/warn This is cxx group, yt link
Anonymous
Hey guys, if anyone.. Please help me out with this.... My task is to find the minimum number of characters at the beginning of a string, so that it becomes pallindrome... I am going with the recursive method.
When I am calling the isPallindrome() function inside the min_insert(), it says isPallindrome is not declared in the scope...
How do I resolve it????
#include<bits/stdc++.h>
using namespace std;
bool ispallindrome(string str,int start,int len)
{
if(start==len)
return true;
else if(str[start]!=str[len])
return false;
else
return ispallindrome(str,start+1,len-1);
}
//start—>starting index of string, len—>length of the string, count—>counter to count the number of characters inserted
int min_insert(string str,int start,int len,int count)
{
if(isPallindrome(str,start,len))
return count;
if(str[start]!=str[len])
{
str.insert(str.begin()+start,str[len]);
count++;
}
else
return min_insert(str,start+1,len-1,count);
}
int main()
{
string str;
cout<<"Enter the string : ";
cin>>str;
cout<<min_insert(str,0,str.length(),0); //min_insert(string, starting_index, length_of_the_string, counter)
return 0;
}
rex
Dima
Hey guys, if anyone.. Please help me out with this.... My task is to find the minimum number of characters at the beginning of a string, so that it becomes pallindrome... I am going with the recursive method.
When I am calling the isPallindrome() function inside the min_insert(), it says isPallindrome is not declared in the scope...
How do I resolve it????
#include<bits/stdc++.h>
using namespace std;
bool ispallindrome(string str,int start,int len)
{
if(start==len)
return true;
else if(str[start]!=str[len])
return false;
else
return ispallindrome(str,start+1,len-1);
}
//start—>starting index of string, len—>length of the string, count—>counter to count the number of characters inserted
int min_insert(string str,int start,int len,int count)
{
if(isPallindrome(str,start,len))
return count;
if(str[start]!=str[len])
{
str.insert(str.begin()+start,str[len]);
count++;
}
else
return min_insert(str,start+1,len-1,count);
}
int main()
{
string str;
cout<<"Enter the string : ";
cin>>str;
cout<<min_insert(str,0,str.length(),0); //min_insert(string, starting_index, length_of_the_string, counter)
return 0;
}
hello and please format your code
Dima
or use pastebin
Anonymous
wait...
Anonymous
Do I have to download the pastebin file and upload here??
rex
Hey guys, if anyone.. Please help me out with this.... My task is to find the minimum number of characters at the beginning of a string, so that it becomes pallindrome... I am going with the recursive method.
When I am calling the isPallindrome() function inside the min_insert(), it says isPallindrome is not declared in the scope...
How do I resolve it????
#include<bits/stdc++.h>
using namespace std;
bool ispallindrome(string str,int start,int len)
{
if(start==len)
return true;
else if(str[start]!=str[len])
return false;
else
return ispallindrome(str,start+1,len-1);
}
//start—>starting index of string, len—>length of the string, count—>counter to count the number of characters inserted
int min_insert(string str,int start,int len,int count)
{
if(isPallindrome(str,start,len))
return count;
if(str[start]!=str[len])
{
str.insert(str.begin()+start,str[len]);
count++;
}
else
return min_insert(str,start+1,len-1,count);
}
int main()
{
string str;
cout<<"Enter the string : ";
cin>>str;
cout<<min_insert(str,0,str.length(),0); //min_insert(string, starting_index, length_of_the_string, counter)
return 0;
}
can u give the input and output
Anonymous
https://pastebin.com/raw/1KqaJ4Af
rex
no not that
rex
what u give the input and u expected from this programme
Anonymous
Input—> abc output—>cbabc So it should return 2 as it is inserting 'c' and 'b' at the beginning
Anonymous
This will give you clarity
rex
ok
rex
i think u cant write isPallindrome inside if statement
rex
because u have defined isPallindrome()
Anonymous
What do I do then??
rex
if returns 1 or 0 then it is ok
rex
but what about last else part in isPallindrome()
Anonymous
If none of the above condition is getting satisfied then it is calling itself again by incrementing the start index by 1 and decrementing the last index by 1
rex
inside if u have to return a int value not a function
rex
it defines no meaning to this
Anonymous
But firstly we need to check wether the string we passed is already pallindrome or not... That's why I am using isPallindrome()
rex
Anonymous
No, it isn't.... But I thought of implementing it using recursive method
Anonymous
I think I'll have to use the other approach to it
rex
why r u tangling urself in this difficult approach
rex
ok
Anonymous
Anyway thank you for discussing... 😊
rex
np
Dęvèloper_Nkya 👨💻
Thank you 🙏
Dima
welcome
Dęvèloper_Nkya 👨💻
Hi everyone.... I'm currently using Turbo C/C++ as my compiler for C codes. Is there a better IDE than this one.
Anonymous
Dima
don’t use neither turbo c or devc++
Dima
use modern ide
Dima
visual studio, clion, qtcreator, codeblocks whatever
Anonymous
Dęvèloper_Nkya 👨💻
You can use devc++
Ohh... Thank you. Someone told me about Visual code too.
Dima
Dęvèloper_Nkya 👨💻
Dima
you can simply install c++ extension and you’ll get your button to run it
Anonymous
Dęvèloper_Nkya 👨💻
In my class.. Visual studio is the one preffered. Followed by Turbo C.
Dima
no
Dima
#googleit
Anonymous
no
So that is why I'm preferring ideas otherwise you have to know make files
Dima
I am telling you can setup a script once to compile everything
Dima
but that’s how what everyone would decide
Anonymous
How can we calculate the integration and differentiation in C ++
Francisco
Francisco
C++ doesn't work like MATLAB or Maxima at all
Francisco
What you can implement is numerical methods to do that, but it isn't an easy task
Anonymous
Thanks for u
Dęvèloper_Nkya 👨💻
Has any one ever thought of making a simple or complex game in c/c++
klimi
yes
Anonymous
Give me tips how to study and see the output without a computer ?
klimi
see output without computer?
klimi
so you are programming a computer, without computer?
klimi
oh this stuff,,,
Anonymous
Like this, without the computer
I_Interface
I_Interface
Then read about arrays and operations with array's elements.
I_Interface