struntz
Dec 13th, 2000, 07:16 PM
Hello everyone!
I am writing alittle program i just started learnign C++ and i can't stand the constant errors i keep getting and i think evertying is right, what did i do wrong here?
#include <iostream.h>
int FindArea(int Lenght, int width){
cout << "you've entered finding areafucntion" << endl;
return (Length * width);
}
int main() {
cout << "Enter Length and then Width." << endl;
cin >> len;
cin >> wid;
int Area;
Area = FindArea(len,wid);
cout << Area << endl;
return 0;
}
i get the errors:
c:\my documents\c++programs\chapter2\findingarea.cpp: In function `int FindArea(int, int)':
c:\my documents\c++programs\chapter2\findingarea.cpp:5: `Length' undeclared (first use this function)
c:\my documents\c++programs\chapter2\findingarea.cpp:5: (Each undeclared identifier is reported only once
c:\my documents\c++programs\chapter2\findingarea.cpp:5: for each function it appears in.)
c:\my documents\c++programs\chapter2\findingarea.cpp:6: parse error before `}'
c:\my documents\c++programs\chapter2\findingarea.cpp: In function `int main()':
c:\my documents\c++programs\chapter2\findingarea.cpp:11: `len' undeclared (first use this function)
c:\my documents\c++programs\chapter2\findingarea.cpp:12: `wid' undeclared (first use this function)
Thanks for Listening! :D
I am writing alittle program i just started learnign C++ and i can't stand the constant errors i keep getting and i think evertying is right, what did i do wrong here?
#include <iostream.h>
int FindArea(int Lenght, int width){
cout << "you've entered finding areafucntion" << endl;
return (Length * width);
}
int main() {
cout << "Enter Length and then Width." << endl;
cin >> len;
cin >> wid;
int Area;
Area = FindArea(len,wid);
cout << Area << endl;
return 0;
}
i get the errors:
c:\my documents\c++programs\chapter2\findingarea.cpp: In function `int FindArea(int, int)':
c:\my documents\c++programs\chapter2\findingarea.cpp:5: `Length' undeclared (first use this function)
c:\my documents\c++programs\chapter2\findingarea.cpp:5: (Each undeclared identifier is reported only once
c:\my documents\c++programs\chapter2\findingarea.cpp:5: for each function it appears in.)
c:\my documents\c++programs\chapter2\findingarea.cpp:6: parse error before `}'
c:\my documents\c++programs\chapter2\findingarea.cpp: In function `int main()':
c:\my documents\c++programs\chapter2\findingarea.cpp:11: `len' undeclared (first use this function)
c:\my documents\c++programs\chapter2\findingarea.cpp:12: `wid' undeclared (first use this function)
Thanks for Listening! :D