Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. HOW to insert String in C++

HOW to insert String in C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    OmarSH
    wrote on last edited by
    #1

    just i am asking what how to let user enter his name , i want to make program that ask you enter your name, your family name,? specify by writing the code please . Thank you

    Y L 2 Replies Last reply
    0
    • O OmarSH

      just i am asking what how to let user enter his name , i want to make program that ask you enter your name, your family name,? specify by writing the code please . Thank you

      Y Offline
      Y Offline
      Yashwanth C b
      wrote on last edited by
      #2

      my frnd you should first include string.h and declarethe variable for example#include"iostream.h" #include"string.h" main(){ string name; cout<<"enter your name"; cin>>name; cout<<"your name is "<

      L 1 Reply Last reply
      0
      • Y Yashwanth C b

        my frnd you should first include string.h and declarethe variable for example#include"iostream.h" #include"string.h" main(){ string name; cout<<"enter your name"; cin>>name; cout<<"your name is "<

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        You should use <pre> tags round code (using the code link above) and line it up properly like:

        include"iostream.h"
        #include"string.h"

        main()
        {
        string name;
        cout << "enter your name";
        cin >> name;
        cout << "your name is "<
        The var link is used to highlight single words or phrases such as int variable; in a sentence.

        Use the best guess

        1 Reply Last reply
        0
        • O OmarSH

          just i am asking what how to let user enter his name , i want to make program that ask you enter your name, your family name,? specify by writing the code please . Thank you

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          It depends on your program type. If it's a console app then see the answer provide by Yashwanth. If it's a Windows app then the normal way would be to use a dialog box. There are many samples to be found which explain how to do it.

          Use the best guess

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups