cout Object के साथ double less than << sign का use करके C++ में Output print किया जाता है।

CopyFullscreenClose FullscreenRun
#include <iostream>
using namespace std;

int main() {
  cout << "Hello World !";
  return 0;
}
Output
Hello World !

आप अपनी need के according कितने ही lines को cout object की help से print कर सकते हैं -

CopyFullscreenClose FullscreenRun
#include <iostream>
using namespace std;

int main() {
  cout << "Hello Students";
  cout << "How are you ?";
  cout << "Who are you ? etc..";
  return 0;
}
Output
Hello StudentsHow are you ?Who are you ? etc..

Print output from new line

जैसा कि आप ऊपर example में देख सकते हैं कि , एक से ज्यादा cout use करने पर सिर्फ output ही print ही रहा है , लेकिन output new line से print नहीं हो रहा है।


New line में output print करने के लिए slash n \n का use किया जाता है।

CopyFullscreenClose FullscreenRun
#include <iostream>
using namespace std;

int main() {
  cout << "Hi !";
  cout << "\nWelcome to learnhidnituts.";
  cout << "\nHere you will find all the programming courses tutorials.";
  cout << "\nKeep it up.";
  return 0;
}
Output
Hi !
Welcome to learnhidnituts.
Here you will find all the programming courses tutorials.
Keep it up.

C++ print variables in single.

एक या एक से ज्यादा variables को आप << की help से single line में print करा सकते हैं।

string name="Rahul Rajput";
string name="Rahul Rajput";
cout << "My Name is : " << name; 

I Hope, आपको समझ में आ गया होगा कि C++ में किस तरह से output print करते हैं।

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook

b2eprogrammers