hey, i am working on my school's c++ project. i need help on this. basically i am making a small banking calculator. it's 70% complete, but i am getting loads of error while compiling. plz help me out on this. i am working with ms visual c++. i have incorporated structures with functions in my program.
code is :
and the errors i am getting are :
code is :
Code:
#include<iostream.h>
#include<conio.h> // For getch() and clrscr()
#include<math.h> // For Math Functions
#include<stdio.h> // For gets() function
void interest(calc_info calc1);
void fd_tds(calc_info calc1);
void invest_func(invest_info invest);
struct calc_info
{
float principal,rate,period;
};
struct invest_info
{
float income,expen,interest,period;
};
int main()
{
cout<<"\t\tWelcome to Banking Calculator by \n";
cout<<"\t\t\tClass : XI-B, Roll Number : 11 \n\n";
int ch;
calc_info calc;
invest_info invest;
cout<<"Enter 1 for calculations regarding Interest \n";
cout<<"Enter 2 for Calculation of Maturity of Fixed Deposit with Tax Deduction at Source ( TDS ) \n";
cout<<"Enter 3 to calculate cash value of an Investment \n";
cin>>ch;
switch(ch)
{
case 1: cout<<"Enter Principal Amount \n";
cin>>calc.principal;
cout<<"Enter Rate of Interest \n";
cin>>calc.rate;
cout<<"Enter Time Period ( In Months )";
cin>>calc.period;
interest(calc);
break;
case 2: cout<<"Enter Principal Amount \n";
cin>>calc.principal;
cout<<"Enter Rate of Interest ( Ask your bank about this !! ) \n";
cin>>calc.rate;
cout<<"Enter the Time period of your fixed deposit ( In Years ) \n";
cin>>calc.period;
fd_tds(calc);
break;
case 3: cout<<"Enter Your Income \n";
cin>>invest.income;
cout<<"Enter Your Expenses amount \n";
cin>>invest.expen;
cout<<"Enter the Interest Rate \n";
cin>>invest.interest;
cout<<"Enter Investment Period \n";
cin>>invest.period;
invest_func(invest);
break;
default: cout<<"Wrong Choice Entered, Aborting \n";
}
return ;
}
void interest(calc_info calc1);
{
float si,ci,co;
int ch1;
cout<<"Enter 1 to calculate Simple Interest \n";
cout<<"Enter 2 to calculate Compount Interest \n";
cout<<"Enter 3 to calculate Commercial Interest \n";
cin>>ch1;
calc1.period=(calc1.period/12);
switch(ch1)
{
case 1: si=((calc1.principal*calc1.rate*calc1.period)/100);
cout<<"The Simple Interest for the Loan is "<<si;
break;
case 2: ci=((calc1.principal*(1+(calc1.rate/100)))^calc1.period;
cout<<"The Compound Interest for the Loan is "<<ci;
break;
case 3: co=((calc1.principal*calc1.rate*(calc1.period*30))/(100*360))
cout<<"The Commercial Interest for the Loan is "<<co;
break;
default: cout<<"Wrong Choice Entered, Aborting \n";
}
}
void invest_func(invest_info invest1)
{
float cash;
cash=((invest1.income-invest1.expen)*(1+invest1.rate/100)^-invest1.period);
cout<<"The cash value of an investment is "<<cash;
}
and the errors i am getting are :
--------------------Configuration: banking_calculator - Win32 Debug--------------------
Compiling...
banking_calculator.cpp
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(5) : error C2065: 'calc_info' : undeclared identifier
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(5) : error C2146: syntax error : missing ')' before identifier 'calc1'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(5) : error C2182: 'interest' : illegal use of type 'void'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(5) : error C2059: syntax error : ')'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(6) : error C2146: syntax error : missing ')' before identifier 'calc1'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(6) : error C2182: 'fd_tds' : illegal use of type 'void'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(6) : error C2059: syntax error : ')'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(7) : error C2065: 'invest_info' : undeclared identifier
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(7) : error C2146: syntax error : missing ')' before identifier 'invest'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(7) : error C2182: 'invest_func' : illegal use of type 'void'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(7) : error C2059: syntax error : ')'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(21) : error C2146: syntax error : missing ';' before identifier 'calc'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(21) : error C2065: 'calc' : undeclared identifier
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(22) : error C2146: syntax error : missing ';' before identifier 'invest'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(22) : error C2065: 'invest' : undeclared identifier
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(30) : error C2228: left of '.principal' must have class/struct/union type
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(32) : error C2228: left of '.rate' must have class/struct/union type
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(34) : error C2228: left of '.period' must have class/struct/union type
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(38) : error C2228: left of '.principal' must have class/struct/union type
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(40) : error C2228: left of '.rate' must have class/struct/union type
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(42) : error C2228: left of '.period' must have class/struct/union type
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(46) : error C2228: left of '.income' must have class/struct/union type
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(48) : error C2228: left of '.expen' must have class/struct/union type
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(50) : error C2228: left of '.interest' must have class/struct/union type
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(52) : error C2228: left of '.period' must have class/struct/union type
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(57) : warning C4508: 'main' : function should return a value; 'void' return type assumed
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(59) : error C2146: syntax error : missing ')' before identifier 'calc1'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(59) : error C2182: 'interest' : illegal use of type 'void'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(59) : error C2059: syntax error : ')'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(60) : error C2447: missing function header (old-style formal list?)
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(82) : error C2146: syntax error : missing ')' before identifier 'invest1'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(82) : error C2182: 'invest_func' : illegal use of type 'void'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(82) : error C2086: 'invest_func' : redefinition
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(82) : error C2059: syntax error : ')'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(83) : error C2143: syntax error : missing ';' before '{'
C:\Documents and Settings\Dhruv Arora\Desktop\C++ Programs\Project - XI\banking_calculator.cpp(83) : error C2447: missing function header (old-style formal list?)
Error executing cl.exe.
banking_calculator.obj - 35 error(s), 1 warning(s)