Message from C, C++ discussions

December 2019

— Not necessary

— 

#include<bits/stdc++.h>
using namespace std;
void missing_char(string str)
{
string new_str="";
int i;
int x=str.length();
for(i=0;i<x;i++)
{
// if(i==x-1)
// break;
if(str[i]!=str[x-1-i])
{

new_str+=str[x-1-i];
}
}
string temp=new_str+str;
cout<<"Insert "<<new_str<<" at the beginning to make it "<<temp;

}
int main()
{
string str;
cout<<"Enter the string : ";
cin>>str;
int x=str.length();
cout<<"\n"<<x<<endl;
cout<<str[x-1]<<"\n";
// int y=missing_char(str);
// cout<<"\nThe missing character is "<<str[y]<<" at position "<<x-y+1<< " to make "<<str<<" pallindrome.";
missing_char(str);
return 0;
}

— Ребят, привет

— Engleesh

— Ok

— Soryy

— fgallego96 here's the code without mess... The previous was mess
#include<bits/stdc++.h>
using namespace std;
void missing_char(string str)
{
string new_str="";
int i;
int x=str.length();
for(i=0;i<x;i++)
{
if(str[i]!=str[x-1-i])
{

new_str+=str[x-1-i];
}
}
string temp=new_str+str;
cout<<"Insert "<<new_str<<" at the beginning to make it "<<temp;

}
int main()
{
string str;
cout<<"Enter the string : ";
cin>>str;
int x=str.length();
cout<<"\n"<<x<<endl;
cout<<str[x-1]<<"\n";
missing_char(str);
return 0;
}

Message permanent page

— Guys, hello. Please help with my code

— Use std:: instead of using namespace std;

— For every cin and cout??

— #include <stdio.h>

//Compiler version gcc 6.3.0

int main()
{
int i, sum=0;
printf("Numbers between A and B, divisible by 3 : \n");

printf ("input A");
scanf "A";
printf ("input B");
scanf "B";

{
if(i%3==0)
{
printf("% 5d",i);

}
}
printf("%d \n");
}

Message permanent page

— Yes, for everything in the STL. It's not that bad once you get used to it