- Home
- Course Category
- Course Result
- Course Detail
Hot Line: 0124-2383121
Course Introduction
Programs for practice
To print a string in C++ programming, first ask to the user to enter any string (like his/her name) and receive the string using the function gets(). Now to print the string, just place the string after cout<<to print the string. Here, we print the string (your name) with Hello, as shown here in the following program.
Source Code: Print String
* C++ Program - Print String */ #include<iostream.h> #include<conio.h> #include<string.h> #include<stdio.h> void main() { clrscr(); char str[20]; cout<<"Enter your first name : "; gets(str); cout<<"Hello, "<<str; getch(); }Output
Enter your first name :blazingminds Hello, blazingminds