开始接触C++(第一天的小Demo)

#include "stdafx.h"
#include <iostream>
#include <cmath>

using namespace std;//一些包含文件需要使用这个命名空间

void sqrt();

int _tmain(int argc, _TCHAR* argv[])
{
	sqrt();

	cin.get();
	return 0;
}

void sqrt()
{
	double area;
	cout << "开方函数使用,请输入一个数字" << endl;
	cin >> area;
	double side;
	side = sqrt(area);
	cout << "sqrt(" << area << ") = " << side << endl;

	cout << "随机数:" << rand() << endl ; 

	cout << "按任意键退出程序..." << endl;
	cin.get();//
}

你可能感兴趣的:(C++)