Using cout and CIN in QT programs

Source: Internet
Author: User

1 First Enter 10 digits, then output.


[CPP]View Plaincopyprint?
    1. #include <QtCore/QCoreApplication>
    2. #include <QtCore/QList>
    3. #include <QTextStream>
    4. int main (int argc, char *argv[])
    5. {
    6. Qcoreapplication app (argc, argv);
    7. Qtextstream Cin (stdin, qiodevice::readonly);
    8. Qtextstream cout (stdout, qiodevice::writeonly);
    9. qlist<int> list;
    10. cout << "Please enter ten numbers:";
    11. //Note that the cout at this time will not automatically flush the buffer at the input
    12. Cout.flush ();
    13. For (int i=0; i<10; i++)
    14. {
    15. int temp;
    16. CIN >> Temp;
    17. List.push_back (temp);
    18. }
    19. qlist<Int>::iterator iter;
    20. For (Iter=list.begin (); Iter!=list.end (); iter++)
    21. cout << *iter << "";
    22. cout << Endl;
    23. return 0;
    24. }

http://blog.csdn.net/small_qch/article/details/6621757

Using cout and CIN in QT programs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.