Read OnLine Cpp Program Example



8 - STRING
PRAC 5 PRAC 6
//strncat() function in c
// It append a portion of string to another string
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char s1[]="Imacc";
char s2[]="Education";
clrscr();
strncat(s1,s2,1);
cout<<"\n Source String=%s"<<s1;
getch();
}
-----output-------
Source String=ImaccE
//strrev() function in c
//It reverse the given string
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char s1[]="Imacc Education";
clrscr();
cout<<"\n Source String="<<strrev(s1);
getch();
}
------output------
Source String=noitacudE ccamI
Previous Next
Download Download