Q:

C++ Program To Print A String

0

Logic:-

 Take an input and using a " For Loop " print string in screen this is a very simple program just like a print a Hello World!.  In this program I use a gets() function this is why we can take an input included with space or in other words we can say that we can take a sentence as in input. For next level, after this problem

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<iostream>
#include<string.h>
using namespace std;
int main()
{
   
    cout<<"=====================================";
    cout<<"\nVisit - www.nerdutella.com";
    cout<<"\n=====================================";
    
  char a[20];
  int i,j;

  cout<<"\n\nEnter The String: ";
  gets(a);  
  cout<<"\n\nYour Entered String is Given Below \n\n";

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

 

Output:

=====================================

Visit - www.nerdutella.com

=====================================

Enter The String: my name is mohamad

Your Entered String is Given Below 

my name is mohamad

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Program to Check Whether Given String is a Pal... >>
<< C++ Program To Reverse a Sentence or String...