找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 449|回复: 2

在线等 菜鸟问题

[复制链接]
发表于 2009-11-3 03:22:40 | 显示全部楼层 |阅读模式 IP:江苏扬州
这个是错误
--------------------Configuration: fig_account - Win32 Debug-------------------- Compiling... fig_account.cpp Linking... fig_account.obj : error LNK2001: unresolved external symbol "public: int __thiscall Account::debit(void)" ([email=?debit@Account@@QAEHXZ]?debit@Account@@QAEHXZ[/email])
fig_account.obj : error LNK2001: unresolved external symbol "public: int __thiscall Account::crddit(void)" ([email=?crddit@Account@@QAEHXZ]?crddit@Account@@QAEHXZ[/email])
fig_account.obj : error LNK2001: unresolved external symbol "public: __thiscall Account::Account(int)" (??0Account@@QAE@H@Z) Debug/
fig_account.exe : fatal error LNK1120: 3 unresolved externals Error executing link.exe. fig_account.exe - 4 error(s), 0 warning(s)

编一个程序实现存款和取款 然后写两次测试对象
-----------------------------------------
//Account.h
#ifndef  ACCOUNT_H
#define  ACCOUNT_H
class Account
{
public:
     Account(int);

  int crddit( );
  int debit();
  void setBalance(int);
  int getBalance();
private:
int blance;
};
#endif
--------------------------------------------------------------
//Account.cpp
#include<iostream>
using namespace std;
#include "Account.h"

Account::Account(int i)
{
  if(i>=0)
     setBalance(i);
  
  else
  {
   setBalance(0);
   cout<<"invalid number";
  }
}

  int Account::crddit()
  {
   int add=0;
  cout<<"input you want to add to number:";
  cin>>add;
  blance+=add;
  cout<<"the blance after add:"<<getBalance()<<endl;
  
  }

  int Account::debit()
  {
   int dicre=0;
  cout<<"input you want to dicre number:";
  cin>>dicre;
  if (dicre<=blance)
  {
   blance-=dicre;
   cout<<"the blance after dicre:";
  }
   else
   cout<<"Debit amount exceeded account blance"<<getBalance()<<endl;
   
  }
  void Account::setBalance(i)
   {
     blance=i;
   }
  int Account::getBalance()
  {
   return balance;
  }
--------------------------------------------------------------------
//fig_account.cpp
#include<iostream>
using namespace std;
#include"Account.h"
int main()
{
Account account1(50);
Account account2(-50);
account1.crddit();
account1.debit();
account2.crddit();
account2.debit();
return 0;

}

谢谢帮小弟看看哈.
我用的是英文版的 VC++6.0
发表于 2009-11-3 03:22:41 | 显示全部楼层 IP:江苏扬州
VC++6.0不支持类的定义和成员函数分开实现,你把Account.h和Account.cpp放到一个文件中就行了。建议学c++换用对标准支持好的编译器,毕竟VC++6.0是98年出来的,到现在c++标准已经有了不少变化。你可以试试VC2005或Dev-c++
回复

使用道具 举报

发表于 2009-11-3 03:22:42 | 显示全部楼层 IP:江苏扬州
谢谢你哈
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 13:31 , Processed in 0.230901 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表