Results 1 to 6 of 6

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

  1. #1
    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??

  2. #2
    Join Date
    Apr 2008
    Posts
    1,949

    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!!!

  3. #3
    Join Date
    May 2008
    Posts
    2,015

    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;
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,010

    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<<.

  5. #5
    Join Date
    May 2008
    Posts
    2,302

    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;
    }

  6. #6
    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!

Similar Threads

  1. Need C program to print triangle of character or number
    By Khan Baba in forum Software Development
    Replies: 5
    Last Post: 17-09-2011, 04:40 PM
  2. What is the program to print table of given number?
    By Roxy_jacob in forum Software Development
    Replies: 5
    Last Post: 04-09-2011, 10:40 PM
  3. What is the difference between cin and cout in C++
    By Brexton in forum Software Development
    Replies: 3
    Last Post: 10-01-2011, 02:48 AM
  4. program to print prime factor of given number
    By teena_pansare in forum Software Development
    Replies: 4
    Last Post: 27-11-2009, 09:21 AM
  5. How to print Chinese character in ASP page
    By Anas in forum Software Development
    Replies: 2
    Last Post: 23-04-2009, 08:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •