Problems with compound interest program

[b]Hey all,

I'm slowly but surely learning C++ and keep on getting compiling errors. So, I check my work in an online compiler. After it checks I tweak my code in netBeans and it still doesn't work. Most recently I wrote this:

#include <iostream>
#include <cmath>

using namespace std;
int main() {

int iTime;
double dRate
double dPrinciple;
double dTotal;

cout <<"Investment cash: ";
cin >> dPrinciple;

cout <<"\nWhat is the rate: ";
cin >> dRate;

cout <<"\nHow long (in years):";
cin >> iTime;

dRate /= 100;
dTotal= dPrinciple*pow((1+dRate), iTime);
cout << dTotal ;

return 0;
}

And I get this error message:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_6'
nbproject/Makefile-Debug.mk:78: warning: overriding recipe for target 'build/Debug/Cygwin_4.x-Windows/newfile.o'
nbproject/Makefile-Debug.mk:73: warning: ignoring old recipe for target 'build/Debug/Cygwin_4.x-Windows/newfile.o'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/cppapplication_6.exe
make[2]: Entering directory '/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_6'
nbproject/Makefile-Debug.mk:78: warning: overriding recipe for target 'build/Debug/Cygwin_4.x-Windows/newfile.o'
nbproject/Makefile-Debug.mk:73: warning: ignoring old recipe for target 'build/Debug/Cygwin_4.x-Windows/newfile.o'
mkdir -p build/Debug/Cygwin_4.x-Windows
rm -f build/Debug/Cygwin_4.x-Windows/newfile.o.d
g++ -c -g -MMD -MP -MF build/Debug/Cygwin_4.x-Windows/newfile.o.d -o build/Debug/Cygwin_4.x-Windows/newfile.o newfile.cpp
mkdir -p dist/Debug/Cygwin_4.x-Windows
g++ -o dist/Debug/Cygwin_4.x-Windows/cppapplication_6 build/Debug/Cygwin_4.x-Windows/idealGasLaw.o build/Debug/Cygwin_4.x-Windows/newfile.o build/Debug/Cygwin_4.x-Windows/newfile.o
build/Debug/Cygwin_4.x-Windows/newfile.o: In function `ZSt3powdi':
/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_6/newfile.cpp:5: multiple definition of `main'
build/Debug/Cygwin_4.x-Windows/idealGasLaw.o:/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_6/idealGasLaw.cpp:4: first defined here
build/Debug/Cygwin_4.x-Windows/newfile.o: In function `ZSt3powdi':
/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_6/newfile.cpp:5: multiple definition of `main'
build/Debug/Cygwin_4.x-Windows/idealGasLaw.o:/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_6/idealGasLaw.cpp:4: first defined here
collect2: error: ld returned 1 exit status
nbproject/Makefile-Debug.mk:64: recipe for target 'dist/Debug/Cygwin_4.x-Windows/cppapplication_6.exe' failed
make[2]: *** [dist/Debug/Cygwin_4.x-Windows/cppapplication_6.exe] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_6'
nbproject/Makefile-Debug.mk:61: recipe for target '.build-conf' failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_6'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2


BUILD FAILED (exit value 2, total time: 957ms)
[/small]

Do you have any suggestions?
closed account (Dy7SLyTq)
you need a semicolon on line 8
Thanks for your help. I tried another simpler program, but it still won't compile:

Program:

#include<iostream>
using namespace std;

int main()
{
cout << "Hello";
return 0;
}

Error message:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_7'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/cppapplication_7.exe
make[2]: Entering directory '/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_7'
mkdir -p dist/Debug/Cygwin_4.x-Windows
g++ -o dist/Debug/Cygwin_4.x-Windows/cppapplication_7 build/Debug/Cygwin_4.x-Windows/main.o build/Debug/Cygwin_4.x-Windows/newfile.o
build/Debug/Cygwin_4.x-Windows/newfile.o: In function `main':
/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_7/newfile.cpp:5: multiple definition of `main'
build/Debug/Cygwin_4.x-Windows/main.o:/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_7/main.cpp:15: first defined here
collect2: error: ld returned 1 exit status
nbproject/Makefile-Debug.mk:63: recipe for target 'dist/Debug/Cygwin_4.x-Windows/cppapplication_7.exe' failed
make[2]: *** [dist/Debug/Cygwin_4.x-Windows/cppapplication_7.exe] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_7'
nbproject/Makefile-Debug.mk:60: recipe for target '.build-conf' failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/Sales4/Documents/NetBeansProjects/CppApplication_7'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2


BUILD FAILED (exit value 2, total time: 651ms)

I think it's my compiler. I've copied programs word for word that work and they still wont compile. Am I missing a tool or file?
Topic archived. No new replies allowed.