Monday, 9 November 2015

C++ Program To Print A String

Problem :- Write A C++ Program To Print A Full String Input By Keyboard

Logic :- Take a Input And Using A loop Print String You Can also See that Example C++ Program To Display String From Backward

Solution :-

#include<iostream>
#include<string.h>
using namespace std;
int main()
{
//By-Ghanendra Yadav
char a[20],a1[20];
int i,j;

cout<<"Enter The String\n";
gets(a);  
cout<<"\nString is Given Below \n";

for(i=0;a[i]!='\0';++i)
cout<<a[i];
return 0;
}

Output:-

C++ Program To Print A String

No comments:
Write comments

Recommended Posts × +