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. string and int

string and int

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
3 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
    Oriented
    wrote on last edited by
    #1

    Visual C++ i think it's a trivial question but i don't know the right syntax: i have, for example : int ID1=70; int age1=55; String (or CString) Name="Bell"; CString All; // i want to make All to be: All=" The ID is " ID1 " and his age is " age1 " and his name is " Name .. how to make this?:-D

    N A 2 Replies Last reply
    0
    • O Oriented

      Visual C++ i think it's a trivial question but i don't know the right syntax: i have, for example : int ID1=70; int age1=55; String (or CString) Name="Bell"; CString All; // i want to make All to be: All=" The ID is " ID1 " and his age is " age1 " and his name is " Name .. how to make this?:-D

      N Offline
      N Offline
      Navin
      wrote on last edited by
      #2

      Check out the CString::Format function: all.Format("The ID is %d and the age is %d", ID1, age1); Remember, even if you win the rat race, you're still a rat.

      1 Reply Last reply
      0
      • O Oriented

        Visual C++ i think it's a trivial question but i don't know the right syntax: i have, for example : int ID1=70; int age1=55; String (or CString) Name="Bell"; CString All; // i want to make All to be: All=" The ID is " ID1 " and his age is " age1 " and his name is " Name .. how to make this?:-D

        A Offline
        A Offline
        avenger_sb25
        wrote on last edited by
        #3

        well i tell a how to achieve it with char*; char[200] str=""; int i=20; double d=10.00; char* s="test string"; wsprintf(str,"The integer is %d and the double is %f and the character array contains %s",i,d,s); NOW str WILL contain "The integer is 20 and the double is 10.000000 and the character array contains test string"


        Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

        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