need help in c++

dhruv227

New Member
Messages
390
Reaction score
1
Points
0
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 :

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)
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
Since I have Linux I can't test it for you (our non-standard headers differ), but I think the following code should be more likely to compile.
Code:
#include <iostream>
#include <conio.h>   // For getch() and clrscr()
#include <math.h>    // For Math Functions
#include <stdio.h>   // For gets() function

using std::cout;
using std::cin;
using std::endl;

void interest(struct calc_info calc1);
void fd_tds(struct calc_info calc1);
void invest_func(struct 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" << endl;
	cout<<"\t\t\tClass : XI-B, Roll Number : 11" << endl << endl;
	int ch;
	struct calc_info calc;
	struct invest_info invest;
	cout<<"Enter 1 for calculations regarding Interest" << endl;
	cout<<"Enter 2 for Calculation of Maturity of Fixed Deposit with Tax Deduction at Source ( TDS )" << endl;
	cout<<"Enter 3 to calculate cash value of an Investment" << endl;
	cin>>ch;
	switch(ch)
	{
	case 1: cout<<"Enter Principal Amount" << endl;
	        cin>>calc.principal;
	        cout<<"Enter Rate of Interest" << endl;
	        cin>>calc.rate;
	        cout<<"Enter Time Period ( In Months )";
	        cin>>calc.period;
			interest(calc);
			break;
	case 2: cout<<"Enter Principal Amount" << endl;
		    cin>>calc.principal;
			cout<<"Enter Rate of Interest ( Ask your bank about this !! )" << endl;
			cin>>calc.rate;
			cout<<"Enter the Time period of your fixed deposit ( In Years )" << endl;
			cin>>calc.period;
			fd_tds(calc);
			break;
	case 3: cout<<"Enter Your Income" << endl;
		    cin>>invest.income;
			cout<<"Enter Your Expenses amount" << endl;
			cin>>invest.expen;
			cout<<"Enter the Interest Rate" << endl;
			cin>>invest.interest;
			cout<<"Enter Investment Period" << endl;
			cin>>invest.period;
			invest_func(invest);
			break;
	default: cout<<"Wrong Choice Entered, Aborting" << endl;
	}
	return 0;
}
void interest(struct calc_info calc1);
{
	float si,ci,co;
	int ch1;
	cout<<"Enter 1 to calculate Simple Interest" << endl;
	cout<<"Enter 2 to calculate Compount Interest" << endl;
	cout<<"Enter 3 to calculate Commercial Interest" << endl;
	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" << endl;
	}
}
void invest_func(struct 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;
}

Things I have changed:
<iostream.h> to <iostream>, I'm not sure it's invalid on Windows, but it is on Linux so I just used the more standard method.

Added:
using std::cout;
using std::cin;
using std::endl;
You're using std::cout and std::cin in your document, but you refer to them as "cout" and "cin". If you wish to do that, you need to either state you use them (as above) or include "using namespace std;" to move your document to the standard namespace.

Changed any instance of "calc_info" to "struct calc_info" and "invest_info" to "struct invest_info". If you define a structure like this:
Code:
struct Name {
  /* fields here */
};
the type is NOT "Name", it is "struct Name". or you can use a typedef, like this:
Code:
struct Name {
  /* fields here */
};
typedef struct Name t_name;
Then the type "t_name" is equivalent with "struct Name".
You can also use typedef like this:
Code:
typedef struct name {
/* fields here */
} t_name;

And a last thing, you use "\n" a lot as output to cout. It's better (more standard) to use std::endl there.
 
Last edited:

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Since I have Linux I can't test it for you (our non-standard headers differ),
@dhruv227: in particular, conio.h isn't standard.


Things I have changed:
<iostream.h> to <iostream>, I'm not sure it's invalid on Windows, but it is on Linux so I just used the more standard method.
<iostream> is the right one to use, according to the standard. It was changed in the '90s.


Added:
using std::cout;
using std::cin;
using std::endl;
You're using std::cout and std::cin in your document, but you refer to them as "cout" and "cin". If you wish to do that, you need to either state you use them (as above) or include "using namespace std;" to move your document to the standard namespace.
Read up on namespaces for more information.

If you define a structure like this:
Code:
struct Name {
  /* fields here */
};
the type is NOT "Name", it is "struct Name".
True in C, not C++. calc_info and invest_info are valid typenames. The problem is they're not declared before use:
Code:
void interest(calc_info calc1);
...
struct calc_info {
The structs need to be declared before the functions. @dhruv227: since the definitions are so short, you might as well define the structs before declaring the functions.

Some other issues:
Code:
int main() {
...
    return ;
}
You can't return nothing when you've declared a return value. Normally the only fix is to return something, but main is special: if you don't return anything, the compiler will have it return 0.

Code:
void interest(calc_info calc1);
{
Extraneous semi-colon.

Code:
    case 2: ci=((calc1.principal*(1+(calc1.rate/100)))[COLOR="Red"]^[/COLOR]calc1.period;
"^" is bitwise XOR, not a power operator. C++ has no power operator; you must use pow. The expression is also missing a closing parenthesis.

Code:
        cash=((invest1.income-invest1.expen)*(1+invest1.rate/100)^-invest1.period);
invest_info doesn't have a rate field. Build before correcting this one so you can see the error message you'll get, which will help you recognize it in the future.

You've declared fd_tds and even call it, but haven't defined it. This is another one to leave off fixing until you've seen the error message you'll get when building (in particular, the error message will be generated during the linking phase).
 
Last edited:

marshian

New Member
Messages
526
Reaction score
9
Points
0
@Mission, you're right, the structs should have been before the function definitions. Also the "struct" keyword isn't required (although that caused some strange results in my last C++ project o_O).
It's still allowed though, so I only moved the struct definitions.

Revised code:
Code:
#include <iostream>
#include <conio.h>   // For getch() and clrscr()
#include <math.h>    // For Math Functions
#include <stdio.h>   // For gets() function

using std::cout;
using std::cin;
using std::endl;

struct calc_info
{
	float principal,rate,period;
};
struct invest_info
{
	float income,expen,interest,period;
};

void interest(struct calc_info calc1);
void fd_tds(struct calc_info calc1);
void invest_func(struct invest_info invest);

int main()
{
	cout<<"\t\tWelcome to Banking Calculator by" << endl;
	cout<<"\t\t\tClass : XI-B, Roll Number : 11" << endl << endl;
	int ch;
	struct calc_info calc;
	struct invest_info invest;
	cout<<"Enter 1 for calculations regarding Interest" << endl;
	cout<<"Enter 2 for Calculation of Maturity of Fixed Deposit with Tax Deduction at Source ( TDS )" << endl;
	cout<<"Enter 3 to calculate cash value of an Investment" << endl;
	cin>>ch;
	switch(ch)
	{
	case 1: cout<<"Enter Principal Amount" << endl;
	        cin>>calc.principal;
	        cout<<"Enter Rate of Interest" << endl;
	        cin>>calc.rate;
	        cout<<"Enter Time Period ( In Months )";
	        cin>>calc.period;
			interest(calc);
			break;
	case 2: cout<<"Enter Principal Amount" << endl;
		    cin>>calc.principal;
			cout<<"Enter Rate of Interest ( Ask your bank about this !! )" << endl;
			cin>>calc.rate;
			cout<<"Enter the Time period of your fixed deposit ( In Years )" << endl;
			cin>>calc.period;
			fd_tds(calc);
			break;
	case 3: cout<<"Enter Your Income" << endl;
		    cin>>invest.income;
			cout<<"Enter Your Expenses amount" << endl;
			cin>>invest.expen;
			cout<<"Enter the Interest Rate" << endl;
			cin>>invest.interest;
			cout<<"Enter Investment Period" << endl;
			cin>>invest.period;
			invest_func(invest);
			break;
	default: cout<<"Wrong Choice Entered, Aborting" << endl;
	}
	return 0;
}
void interest(struct calc_info calc1);
{
	float si,ci,co;
	int ch1;
	cout<<"Enter 1 to calculate Simple Interest" << endl;
	cout<<"Enter 2 to calculate Compount Interest" << endl;
	cout<<"Enter 3 to calculate Commercial Interest" << endl;
	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" << endl;
	}
}
void invest_func(struct 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;
}

Edit:
A bit info-less post, so I'll add this to make it more informative:
You could also use a header file instead. This is particulary useful for documents with many functions, object definitions etc. And it's almost a necessity for programs consisting of multiple files.

Say your program is called "dhruv.cpp", then we'd call the header "dhuv.h".

"dhruv.h":
Code:
#ifndef DHRUV_H_
#define DHRUV_H_

/* Structs */
struct calc_info
{
	float principal,rate,period;
};
struct invest_info
{
	float income,expen,interest,period;
};

/* Functions */
void interest(struct calc_info calc1);
void fd_tds(struct calc_info calc1);
void invest_func(struct invest_info invest);
int main();

#endif /* DHRUV_H_ */

"dhruv.cpp":
Code:
#include <iostream>
#include <conio.h>   // For getch() and clrscr()
#include <math.h>    // For Math Functions
#include <stdio.h>   // For gets() function

#include "dhruv.h"

using std::cout;
using std::cin;
using std::endl;

int main()
{
	cout<<"\t\tWelcome to Banking Calculator by" << endl;
	cout<<"\t\t\tClass : XI-B, Roll Number : 11" << endl << endl;
	int ch;
	struct calc_info calc;
	struct invest_info invest;
	cout<<"Enter 1 for calculations regarding Interest" << endl;
	cout<<"Enter 2 for Calculation of Maturity of Fixed Deposit with Tax Deduction at Source ( TDS )" << endl;
	cout<<"Enter 3 to calculate cash value of an Investment" << endl;
	cin>>ch;
	switch(ch)
	{
	case 1: cout<<"Enter Principal Amount" << endl;
	        cin>>calc.principal;
	        cout<<"Enter Rate of Interest" << endl;
	        cin>>calc.rate;
	        cout<<"Enter Time Period ( In Months )";
	        cin>>calc.period;
			interest(calc);
			break;
	case 2: cout<<"Enter Principal Amount" << endl;
		    cin>>calc.principal;
			cout<<"Enter Rate of Interest ( Ask your bank about this !! )" << endl;
			cin>>calc.rate;
			cout<<"Enter the Time period of your fixed deposit ( In Years )" << endl;
			cin>>calc.period;
			fd_tds(calc);
			break;
	case 3: cout<<"Enter Your Income" << endl;
		    cin>>invest.income;
			cout<<"Enter Your Expenses amount" << endl;
			cin>>invest.expen;
			cout<<"Enter the Interest Rate" << endl;
			cin>>invest.interest;
			cout<<"Enter Investment Period" << endl;
			cin>>invest.period;
			invest_func(invest);
			break;
	default: cout<<"Wrong Choice Entered, Aborting" << endl;
	}
	return 0;
}
void interest(struct calc_info calc1);
{
	float si,ci,co;
	int ch1;
	cout<<"Enter 1 to calculate Simple Interest" << endl;
	cout<<"Enter 2 to calculate Compount Interest" << endl;
	cout<<"Enter 3 to calculate Commercial Interest" << endl;
	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" << endl;
	}
}
void invest_func(struct 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;
}

In case you were wondering about these lines
Code:
#ifndef DHRUV_H_
#define DHRUV_H_
/* ... */
#endif
They are preprocessor directives. When the preprocessor starts processing your "dhruv.cpp", it sees "dhruv.h" has to be included. Then it checks "dhruv.h", and if "DHRUV_H_" is not already defined, it defines it and copies anything inside the ifndef and endif. If a file would be included twice (this gets important in multi-file programs!) DHRUV_H_ will already be defined, so the content of "dhruv.h" doesn't get copied again. If it would have been copied, you would have multiple definitions of anything in "dhruv.h", causing the compiler to fail.
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
How to debug.

Read the error message.

Error is:

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


Code is:

1. #include<iostream.h>
2. #include<conio.h> // For getch() and clrscr()
3. #include<math.h> // For Math Functions
4. #include<stdio.h> // For gets() function
5. void interest(calc_info calc1);
6. void fd_tds(calc_info calc1);
7. void invest_func(invest_info invest);
8. struct calc_info
{
float principal,rate,period;
};

Error message says error is on line 5.
Error message says calc_info is not defined.
You defined it on line 8.
 
Last edited:

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
@marshian: since this is homework, it's best not to rewrite the code for the OP. We don't want to be too helpful.
 
Top