A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

C++ Program To Print A String
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)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now