主题:dev c++中编译遇到的问题,请教
#include <iostream> #include <fstream> #include <conio.h> #include <iomanip> using namespace std; void deposit(); void withdraw(); void viewtotal(); void setgoal(); int main(){ char select; cprintf("money manager "); cout<<"\n\n\t<1>deposit"<<endl; cout<<"\n\t<2>withdraw"<<endl; cout<<"\n\t<3>view total"<<endl; cout<<"\n\t<4>set goal"<<endl; cout<<"\n\t<0>exit"<<endl; cout<<"\n\n\t enter selection:"; cin>>select; if(select=='1'){deposit();}else{ if(select=='2'){withdraw();}else{ if(select=='3'){viewtotal();}else{ if(select=='4'){setgoal();}else{ if(select=='0') goto mml; else{ main(); } }}}} mml: return 0; } void deposit() //存款 { double damt=0; char ans; double num=0; ifstream get("deposit.txt");//打开存款文件 get>>num;//将原文件内取出 get.close(); cprintf("deposit "); cout<<"\n\n\t enter deposit amount: $"; cin>>damt;//输入欲存钱数 if(damt<=0) { cout<<"\n\n\n\n\n"<<endl; cprintf(" that was an invalid amount.."); getch(); main(); } else { cout<<"\n\n\t amount entered<"<<damt<<">."<<endl; cout<<"\n\t continue with deposit<y/n>:"; cin>>ans; if(ans=='y'||ans=='Y') { damt=damt+num; ofstream save("deposit.txt"); save<<damt<<endl; save.close(); cout<<"\n\n\n\n\n"<<endl; cprintf(" yor deposit was successful..."); getch(); main(); } else main(); main(); } } void withdraw() //取款 { double wamt=0; char ans; double num=0; ifstream get("withdraw.txt");//打开取款文件 get>>num; get.close(); cprintf("withdraw "); cout<<"\n\n\t enter withdraw amount: $"; cin>>wamt;//输入要取款项 if(wamt<=0) { cout<<"\n\n\n\n\n"<<endl; cprintf(" that was an invalid amount.."); getch(); main(); } else { cout<<"\n\n\t amount entered<"<<wamt<<">."<<endl; cout<<"\n\t continue with withdrawal<y/n>:"; cin>>ans; if(ans=='y'||ans=='Y') { wamt=wamt+num;//支出总额 ofstream save("withdraw.txt"); save<<wamt<<endl; save.close(); cout<<"\n\n\n\n\n"<<endl; cprintf(" yor withdrawal was successful..."); getch(); main(); } else main(); main(); } } void setgoal()//存款目标 { double setamt=0; cprintf("set goal"); cout<<"\n\n\t set goal amount:"; cin>>setamt; ofstream set("goal.txt"); set<<setamt<<endl; set.close(); cout<<"\n\n\n\n\n"<<endl; cprintf(" goal amount was set..."); getch(); main(); } void viewtotal()//总体情况 { double damt=0; double wamt=0; double gamt=0; double balance=0; double newbalance=0; ifstream getdeposit("deposit.txt"); getdeposit>>damt;//存款 getdeposit.close(); ifstream getwithdraw("withdraw.txt"); getwithdraw>>wamt;//支出 getwithdraw.close(); ifstream getgoal("goal.txt"); getgoal>>gamt;//目标 getgoal.close(); balance=damt-wamt;//盈余 cprintf("view totals"); cout<<"\n\n"<<endl; cprintf(" total amounts"); cout<<""<<endl; cprintf(" ==================="); cout<<"\n\n"<<endl; cprintf("deposit total withdraw total balance total"); cout<<"\n"<<endl; cout<<setw(15)<<damt<<setw(25)<<wamt<<setw(20)<<balance<<endl; newbalance=gamt-balance;//距离目标差距 cout<<"\n\n\n"<<endl; cprintf(" total balance"); cout<<""<<endl; cprintf(" ==================="); cout<<"\n\n"<<endl; cprintf("set goal total balance total balance left"); cout<<"\n"<<endl; cout<<setw(5)<<gamt<<setw(25)<<balance<<setw(23)<<newbalance<<endl; getch(); main(); }
最后编译无法通过,显示好几个undefined reference to‘cprintf’
最后显示error ld returned 1 exit status
用的Dev c++ 程序是照着书上原封不动打上去的,新手,不懂怎么改,求指教