SlideShare a Scribd company logo
1 of 5
Program palindrome
#include <iostream>
#include<string>
usingnamespace std;
intmain()
{
stringstr;
bool check=false;
cout<< "Please Enterthe StringtoCheckPalindrom";
cin>>str;
for(inti=0,j=str.length()-1;i<=(str.length())/2,j>=(str.length())/2;i++,j--)
{
if(str[i]==str[j])
{
check=true;
}
else
{
check=false;
i=str.length()+10;
}
}
if(check==true)
cout<<"palindrom";
else
cout<<"not palindrom";
return0;
}
Program capitalization1
#include <iostream>
#include<string>
usingnamespace std;
intmain()
{
stringstr,temp="";
bool check=false;
cout<< "Please Enterthe String n";
cin>>str;
for(inti=0;i<str.length();i++)
{
intaascii=(int)str[i];
if(aascii>=97&& aascii<=122)
{
aascii=aascii-32;
temp=temp+(char)aascii;
}
else
{
temp=temp+str[i];
}
}
cout<<temp;
return0;
}
Program 3 :
#include <iostream>
#include<string>
usingnamespace std;
intmain()
{
stringtemp= "",str;
bool check= true;
cout << "Please Enterthe String n";
getline(cin,str);
for (inti = 0; i<str.length();i++)
{
if (str[i] == ' ')
{
check= true;
temp= temp+ str[i];
i++;
}
if (check== true)
{
check= false;
intasscii = (int)str[i];
if (asscii >= 97 && asscii <= 122)
{
asscii = asscii - 32;
temp= temp+ (char)asscii;
}
else if (asscii >=65 && asscii <= 91)
{
temp= temp+ str[i];
}
}
else
temp= temp+ str[i];
}
cout << temp;
return0;
}

More Related Content

What's hot (20)

Dsa 1
Dsa 1Dsa 1
Dsa 1
 
Cr
CrCr
Cr
 
Correcion de la preueba de pro..
Correcion de la preueba de pro..Correcion de la preueba de pro..
Correcion de la preueba de pro..
 
vecotores programacion
vecotores programacionvecotores programacion
vecotores programacion
 
Programa
ProgramaPrograma
Programa
 
Programa para leer letras
Programa para leer letrasPrograma para leer letras
Programa para leer letras
 
Info clasa
Info clasaInfo clasa
Info clasa
 
Bubble sort
Bubble sortBubble sort
Bubble sort
 
C Program : Sorting : Bubble,
C Program : Sorting : Bubble, C Program : Sorting : Bubble,
C Program : Sorting : Bubble,
 
Lector
LectorLector
Lector
 
IMPLEMENTATION OF AUTO KEY IN C++
IMPLEMENTATION OF AUTO KEY IN C++IMPLEMENTATION OF AUTO KEY IN C++
IMPLEMENTATION OF AUTO KEY IN C++
 
Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2
 
Ooprc3b
Ooprc3bOoprc3b
Ooprc3b
 
Alocação Dinâmica em C
Alocação Dinâmica em CAlocação Dinâmica em C
Alocação Dinâmica em C
 
Doi xung mang mot chieu
Doi xung mang mot chieuDoi xung mang mot chieu
Doi xung mang mot chieu
 
Ooprc3a
Ooprc3aOoprc3a
Ooprc3a
 
Vcs19
Vcs19Vcs19
Vcs19
 
Play fair cipher
Play fair cipherPlay fair cipher
Play fair cipher
 
N primo clase programa
N primo clase programaN primo clase programa
N primo clase programa
 
Novatadas en java
Novatadas en javaNovatadas en java
Novatadas en java
 

More from Lahore Garrison University

A Light Introduction to Transfer Learning for NLP
A Light Introduction to Transfer Learning for NLPA Light Introduction to Transfer Learning for NLP
A Light Introduction to Transfer Learning for NLPLahore Garrison University
 
Assignment hci : Draw the Users Mental Model for a Transfer of Money from one...
Assignment hci : Draw the Users Mental Model for a Transfer of Money from one...Assignment hci : Draw the Users Mental Model for a Transfer of Money from one...
Assignment hci : Draw the Users Mental Model for a Transfer of Money from one...Lahore Garrison University
 

More from Lahore Garrison University (20)

NLP
NLPNLP
NLP
 
Diagnostic Expert System
Diagnostic Expert SystemDiagnostic Expert System
Diagnostic Expert System
 
A Light Introduction to Transfer Learning for NLP
A Light Introduction to Transfer Learning for NLPA Light Introduction to Transfer Learning for NLP
A Light Introduction to Transfer Learning for NLP
 
cloud
cloud cloud
cloud
 
Heuristic evaluation on Whatsapp
Heuristic evaluation on WhatsappHeuristic evaluation on Whatsapp
Heuristic evaluation on Whatsapp
 
Assignmnet 1hci tasmiya 209
Assignmnet 1hci tasmiya 209Assignmnet 1hci tasmiya 209
Assignmnet 1hci tasmiya 209
 
Windows and linux
Windows and linuxWindows and linux
Windows and linux
 
Automatic plant watering system
Automatic plant watering systemAutomatic plant watering system
Automatic plant watering system
 
Numerical computing assignment 1
Numerical computing  assignment 1Numerical computing  assignment 1
Numerical computing assignment 1
 
Instagram human computer interaction project
Instagram human computer interaction project Instagram human computer interaction project
Instagram human computer interaction project
 
Cloud quiz question answer
Cloud quiz question answerCloud quiz question answer
Cloud quiz question answer
 
Fomulae numerical computing
Fomulae numerical computing Fomulae numerical computing
Fomulae numerical computing
 
Ventilator
VentilatorVentilator
Ventilator
 
Pact framework in hci
Pact framework in hciPact framework in hci
Pact framework in hci
 
Human computer interaction assignment 01
Human computer interaction  assignment 01Human computer interaction  assignment 01
Human computer interaction assignment 01
 
Quiz 1 cloud computing
Quiz 1 cloud computing Quiz 1 cloud computing
Quiz 1 cloud computing
 
Assignment hci : Draw the Users Mental Model for a Transfer of Money from one...
Assignment hci : Draw the Users Mental Model for a Transfer of Money from one...Assignment hci : Draw the Users Mental Model for a Transfer of Money from one...
Assignment hci : Draw the Users Mental Model for a Transfer of Money from one...
 
Cc lectures
Cc lecturesCc lectures
Cc lectures
 
professional practice case study
professional practice case study professional practice case study
professional practice case study
 
Cricket team
Cricket team Cricket team
Cricket team
 

programs

  • 1. Program palindrome #include <iostream> #include<string> usingnamespace std; intmain() { stringstr; bool check=false; cout<< "Please Enterthe StringtoCheckPalindrom"; cin>>str; for(inti=0,j=str.length()-1;i<=(str.length())/2,j>=(str.length())/2;i++,j--) { if(str[i]==str[j]) { check=true; } else { check=false; i=str.length()+10; } } if(check==true) cout<<"palindrom"; else cout<<"not palindrom";
  • 2. return0; } Program capitalization1 #include <iostream> #include<string> usingnamespace std; intmain() { stringstr,temp=""; bool check=false; cout<< "Please Enterthe String n"; cin>>str; for(inti=0;i<str.length();i++) { intaascii=(int)str[i]; if(aascii>=97&& aascii<=122) { aascii=aascii-32; temp=temp+(char)aascii; } else {
  • 3. temp=temp+str[i]; } } cout<<temp; return0; } Program 3 : #include <iostream> #include<string> usingnamespace std; intmain() { stringtemp= "",str; bool check= true; cout << "Please Enterthe String n"; getline(cin,str);
  • 4. for (inti = 0; i<str.length();i++) { if (str[i] == ' ') { check= true; temp= temp+ str[i]; i++; } if (check== true) { check= false; intasscii = (int)str[i]; if (asscii >= 97 && asscii <= 122) { asscii = asscii - 32; temp= temp+ (char)asscii; } else if (asscii >=65 && asscii <= 91) { temp= temp+ str[i]; } } else temp= temp+ str[i]; }