Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How can I print any number or character using cout in C++

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 26-02-2010
Member
 
Join Date: Jan 2010
Posts: 22
How can I print any number or character using cout in C++
  

I am working in the XYZ company as programmer. From last month I am working on the one project which uses the C++ language for programming. Hence, while working on the project in one place I have to print the number on the form. But I can not came to know which statement can I use. So, I want to know about the cout statement of the C++ language. Can anyone tell me about the cout statement??

Reply With Quote
  #2  
Old 26-02-2010
Member
 
Join Date: Apr 2008
Posts: 1,948
CPP : How can I print any number or character using cout in C++

The cout can be an object of the class ostream that can represents the standard output stream. The cout can be corresponds to the cstdio stream stdout. By using the cout statement you can be able to print the any character or the number that can be on the form. I hope you can understand from the above description of the cout statement. If you can not understands then reply me!!!
Reply With Quote
  #3  
Old 26-02-2010
Member
 
Join Date: May 2008
Posts: 2,007
re: How can I print any number or character using cout in C++

This program can demonstrates you that how to print the anything in the forum using the cout statement of the C++ language as follows :
Code:
#include <iostream>
using namespace std;
int main()
{
cout << " Michael Hawkinberry\n6393 Harlem-Grovetown Road,
Harlem, Georgia, 30814\n(706) 556-3731\nComputer Science " << endl;
return 0;
}
Reply With Quote
  #4  
Old 26-02-2010
Member
 
Join Date: Apr 2008
Posts: 2,000
Re: How can I print any number or character using cout in C++

Most of the systems can have their standard output set that can be to the console where text messages can be shown even though this can be redirected, By default. Because cout can be an object of the class ostream. You can write the characters to cout either as unformatted data using the write member function or formatted data that can be using for an example the insertion operator as like ostream::oprtr<<.
Reply With Quote
  #5  
Old 26-02-2010
Member
 
Join Date: May 2008
Posts: 2,291
Re: How can I print any number or character using cout in C++

For printing a value onto the screen you can have to write the word cout that can be followed by the operator (<<) that can be insertion operator which you can create by typing the character (<) twice.
Code:
#include <stdlib.h>
#include <iostream.h>
int main()
{
char *url = "WWW";
while(*url)
cout.put (*url++);
cout<<endl;
return 0;
}
Reply With Quote
  #6  
Old 26-02-2010
Member
 
Join Date: Nov 2005
Posts: 1,323
Re: How can I print any number or character using cout in C++

PROGRAM :
Code:
#include <iostream.h>
int main()
{
cout << "Hello there.\n";
cout << "Here is 6: " << 6 << "\n";
cout << "The manipulator endl writes a new line to the screen." <<  
        ¬endl;
cout << "And a very very big number:\t" << (double) 7000 * 7000 << 
                      ¬endl;
cout << "Don't forget to replace Baski with your name...\n";
cout << "Baski is a C++ programmer!\n";
return 0;
}
OUTPUT :
Code:
Hello there.
Here is 6: 6
The manipulator endl writes a new line to the screen.
And a very very big number:     4.9e+07
Don't forget to replace Baski with your name...
Baski is a C++ programmer!
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How can I print any number or character using cout in C++"
Thread Thread Starter Forum Replies Last Post
Need C program to print triangle of character or number Khan Baba Software Development 5 17-09-2011 05:40 PM
What is the program to print table of given number? Roxy_jacob Software Development 5 04-09-2011 11:40 PM
What is the difference between cin and cout in C++ Brexton Software Development 3 10-01-2011 03:48 AM
program to print prime factor of given number teena_pansare Software Development 4 27-11-2009 10:21 AM
How to print Chinese character in ASP page Anas Software Development 2 23-04-2009 09:43 AM


All times are GMT +5.5. The time now is 12:33 AM.