Two Questions

This is a discussion on Two Questions within the C++ Programming forums, part of the General Programming Boards category; 1. cout<<"blah"; cot<<"blah"; How do I make this show up as: blah blah instead of blahblah? 2. How do I ...

  1. #1
    BlahBlahBlah
    Guest

    Two Questions

    1.


    cout<<"blah";

    cot<<"blah";



    How do I make this show up as:

    blah
    blah

    instead of

    blahblah?

    2. How do I make dialogs instead of using Command Prompt to run it?

    I am using Dev-C++ 4.9.6.0. Thanks.

  2. #2
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    Code:
    cout << "blah\n blah";
    
    // or
    
    cout << "blah" << endl << "blah"
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  3. #3
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    1.
    Code:
    // to take a new line to one of the following
    // you could do it like this
    cout << "\n";
    // or like this
    cout << endl;
    2. I dont really know what you mean, but to get into windows programming, find out about the win32bit API.
    Last edited by face_master; 11-28-2002 at 12:45 AM.
    Please direct all complaints regarding this post to the nearest brick wall Have a nice day.

  4. #4
    BlahBlahBlah
    Guest
    I wanna create something like a GUI, like most programs have. Any good tutorial for those stuff?

  5. #5
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Originally posted by BlahBlahBlah
    I wanna create something like a GUI, like most programs have. Any good tutorial for those stuff?
    to get into windows programming, find out about the win32bit API
    Please direct all complaints regarding this post to the nearest brick wall Have a nice day.

  6. #6
    BlahBlahBlah
    Guest
    thanks, another thing, how do I make the variable type "char" show stuff with unlimited length and allows spaces in between?

  7. #7
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Code:
    // instead of using this:
    cin >> char_array;
    // use this
    cin.getline(char_array, 100, "\n"); // cin.getline(variable to read, amount of characters to read, what character to read up to)
    Please direct all complaints regarding this post to the nearest brick wall Have a nice day.

  8. #8
    Registered User
    Join Date
    Nov 2002
    Posts
    43
    me <--blahblahblah, i just registered


    so it has nothing to do with the Char thing? it will save stuff even with a space?


    I want something like Hello World to show up as Hello World, not just Hello

  9. #9
    Registered User
    Join Date
    Nov 2002
    Posts
    43
    I tried that and it returned me this compile error:

    13 C:\Documents and Settings\Reuben\My Documents\crapp.cpp
    no matching function for call to `_IO_istream_withassign::getline (char[100], int, const char[2])'


    what do i do

    the whole code:;



    #include <iostream.h>

    int main()
    {

    cout<<"I demand your name";
    cout<<"\n";
    cout<<"### Blah ###";
    cout<<"\n";
    cout<<"### Testers: DO NOT GIVE THIS TO YOUR FRIENDS OR ANYBODY ELSE ###";
    cout<<"\n";
    char insane[100];
    cin.getline(insane, 100, "\n");
    count<<insane;
    cin.get();

    cin.get();
    cin.get();
    return 0;
    }

  10. #10
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    uh...try it without the "\n" paremeter
    Please direct all complaints regarding this post to the nearest brick wall Have a nice day.

  11. #11
    Registered User
    Join Date
    Nov 2002
    Posts
    43
    I used '\n' and it worked. Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 08:47 AM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  3. Several Questions, main one is about protected memory
    By Tron 9000 in forum C Programming
    Replies: 3
    Last Post: 06-02-2005, 07:42 AM
  4. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 08:44 AM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 07:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21