Convert Strings to Numbers : String to Number « Data Type « Visual C++ .NET






Convert Strings to Numbers

 



#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
int main(void) {
    int a = Int32::Parse("123");
    int b = Int32::Parse("$547,295.00");
    double c = Double::Parse("123.456");
    double d = Double::Parse("5.743955e+005");
    Console::WriteLine(a);
    Console::WriteLine(b);
    Console::WriteLine(c);
    Console::WriteLine(d);
    return 0;
}

   
  








Related examples in the same category

1.Convert String to decimal
2.parse the string to get the integer value