Console::WriteLine

hi,

im new to C++ .NET

so for Console::WriteLine(S"The number is {0,1:c} {1}", B, "TT") ;
what {0,1:c} and {1} means

and my program start like,

#include "stdafx.h"
using namespace System;
int _tmain()
{
char B ;
Console::WriteLine((String ^)"Hello world");
B = getch() ;
Console::WriteLine(S"The number is {0} {1}", B, "TT") ;
getch() ;
return 0;
}

on second WriteLine output, B value is in numbers, how to get character output using WriteLine i know printf can, but i wanna know how for WriteLine

Thanks



Answer this question

Console::WriteLine

  • Judas

    See :-

    http://msdn2.microsoft.com/en-us/library/txafckwd.aspx

    http://msdn2.microsoft.com/en-us/library/dwhawy9k.aspx

    nujum wrote:
    hi,

    im new to C++ .NET

    so for Console::WriteLine(S"The number is {0,1:c} {1}", B, "TT") ;
    what {0,1:c} and {1} means

    and my program start like,

    #include "stdafx.h"
    using namespace System;
    int _tmain()
    {
    char B ;
    Console::WriteLine((String ^)"Hello world");
    B = getch() ;
    Console::WriteLine(S"The number is {0} {1}", B, "TT") ;
    getch() ;
    return 0;
    }

    on second WriteLine output, B value is in numbers, how to get character output using WriteLine i know printf can, but i wanna know how for WriteLine

    Thanks



  • MP2006

    hmm.. thank you anyway, thats also new infomation for me.. but thats not what im looking for..

    for example,

    B = getch() ; // this will store int ascii value of the character entered to B

    printf("u hav pressed %c",B) ; // this will print 'u hav pressed c' on console screen if u press 'c'

    now in Console::Write

    Console::WriteLine(S"u hav pressed {0}", B) ; // however this will print 'u hav press 99' instead

    so any suggestion how could i get the same output


  • Console::WriteLine