64,636
社区成员
发帖
与我相关
我的任务
分享
// Hello.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "Hello.h"
#include <iostream>
using namespace std;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure, Leave the code here would be OK.
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
CString strHello = "Hello kangnixi";
//strHello.LoadString(IDS_HELLO); I will press F5 to debug.? seen>?
cout << (LPCTSTR)strHello << endl;
CString ting1="1234";
int i_num=atoi(ting1);
cout.precision(20);
cout<<std:: showpoint<<i_num<<endl;
CString ting2="1234";
double d_num=atof(ting2);
cout.precision(100);
cout<<std:: showpoint<<d_num<<endl;
}
return nRetCode;
}
// 定义应用程序对象
CWinApp theApp;
// 使用标准命名空间
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
// 定义返回码
int nRetCode = 0;
// 用于MFC初始化
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// 定义一个字符串变量
CString strHello = "Hello kangnixi";
// 输出
cout << (LPCTSTR)strHello << endl;
// 定义字符串变量
CString ting1="1234";
// 把字符串转化为整型
int i_num=atoi(ting1);
// 设置有效数字位数
cout.precision(20);
// 输出
cout<<std:: showpoint<<i_num<<endl;
// 字符串转符点型
CString ting2="1234";
double d_num=atof(ting2);
// 有效位数100
cout.precision(100);
// 输出
cout<<std:: showpoint<<d_num<<endl;
}
return nRetCode;
}