chapter8test7
来源:互联网 发布:手机淘宝在哪里做代理 编辑:程序博客网 时间:2024/04/28 11:17
#include<iostream>
using namespace std;
template<typename T>
T sum(T arr[], int n);
template<typename T>
T sum(T *arr[], int n);
struct debts
{
char name[20];
double amount;
};
int mian()
{
int things[6] = { 13, 25, 4, 10, 6, 98 };
debts mr[3] = {
{ "Ima Wolfe", 2400.0 },
{"Ura Foxe",1300.0},
{"Iby Stout",1800.0}
};
double *pd[3];
for (int i = 0; i < 3; i++)
pd[i] = &mr[i].amount;
cout << "Sum of Mr.'s countsof things: " << sum(things, 6) << endl;
double s = sum(pd, 3);
cout << "Sum of Mr.'s debts: " << s;
return 0;
}
template<typename T>
T sum(T arr[], int n)
{
T total=0;
for (int i = 0; i < n; i++)
total = arr[i];
return total;
}
template<typename T>
T sum(T *arr[], int n)
{
T total=0;
for (int i = 0; i < n; i++)
total += *(arr[i]);
return total;
}
这段程序在我的VS2013上边没有运行出来,错误提示如下,也不知道因问什么,求大神知道的告诉我
Error 1error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartupE:\tool software\VS2013_RTM_ULT_ENU\my wotk\chapter8job7\chapter8job7\MSVCRTD.lib(crtexe.obj)chapter8job7
Error 2 error LNK1120: 1 unresolved externals E:\tool software\VS2013_RTM_ULT_ENU\my wotk\chapter8job7\Debug\chapter8job7.exe1 1 chapter8job7
Error 2 error LNK1120: 1 unresolved externals E:\tool software\VS2013_RTM_ULT_ENU\my wotk\chapter8job7\Debug\chapter8job7.exe1 1 chapter8job7
0 0
- chapter8test7
- Unity3D 获取控件四个角在屏幕上的坐标
- (转)CONFIG_DM9000_BASE
- WSGI接口
- 流量限制--令牌桶和漏桶算法(流量整形算法)
- Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
- chapter8test7
- android:windowSoftInputMode属性详解
- 求LIS(O(nlogn))及fill、lower_bound、upper_bound函数
- 互联网人口红利消失后,内容收费迫近
- J哥---------北京Android各招聘公司面试实战总结
- html权威指南笔记
- windows sockets之WSAAsyncSelect
- 好用的曲线方程
- Python工具easy_install 和 pip的安装