When I build this program, I get an error message; not from Visual Studio, but from my computer. Can anyone help me?
Code:
#include<iostream>
#include<fstream>
#include<iomanip>
#include<string>
using namespace std;
int main ()
{
int interest1, interest2, interest3;
string name1, name2, name3;
int month1, day1, yr1, loanAmount1;
int month2, day2, yr2, loanAmount2;
int month3, day3, yr3, loanAmount3;
string currentDateMonths, currentDateDays,currentDateYears;
string fileMonth, fileDays, fileYears;
int totaldays1, totaldays2, totaldays3;
ifstream infile;
infile.open("data3.txt", ifstream::in);
ofstream outfile1, outfile2, outfile3;
outfile1.open("Michael.txt", ofstream::out);
outfile2.open("Sonny.txt", ofstream::out);
outfile3.open("Don.txt", ofstream::out);
infile >> currentDateMonths >> currentDateDays >> currentDateYears;
infile >> name1 >> month1 >> day1 >> yr1 >> loanAmount1;
infile >> name2 >> month2 >> day2 >> yr2 >> loanAmount2;
infile >> name3 >> month3 >> day3 >> yr3 >> loanAmount3;
cout << "Please enter the date you wish to calculate interest with in the Month - Day - Year format: " << endl;
cin >> currentDateMonths >> currentDateDays >> currentDateYears;
while (totaldays1 < 29)
{
outfile1 << name1 << '\t' << (loanAmount1 + interest1) << '\t' << (28 - totaldays1) << endl;
}
infile.close();
return 0;
}
//Loan Length
int loanTime1 ()
{
int month1, day1;
int currentDateMonths, currentDateDays, totaldays1;
if (month1 = currentDateMonths)
{
totaldays1 = (currentDateDays - day1);
}
if (month1 = (currentDateDays - day1))
{
if(month1 = 1 || 3 || 5 || 7 || 8 || 10 || 12);
{
totaldays1 = (31 - day1) + currentDateDays;
}
}
if (month1 = currentDateMonths - 2)
{
if (month1 = 1 || 2);
{
totaldays1 = (59 - day1) + currentDateDays;
}
}
if (month1 > currentDateMonths)
{
if (month1 = 11);
{
totaldays1 = (61 - day1) + currentDateDays;
}
if (month1 = 12);
{
totaldays1 = (31 - day1) + currentDateDays;
}
}
if (currentDateMonths = 1)
totaldays1 = (31 - day1) + currentDateDays;
else if(currentDateMonths = 2)
totaldays1 = (62 - day1) + currentDateDays;
else (month1 < currentDateMonths);
if (month1 = 11 && currentDateMonths == 1);
{
totaldays1 = (61 - day1) + currentDateDays;
}
if (month1 = 11 && currentDateMonths >= 2);
{
totaldays1 = 60;
}
if (month1 = 12 && currentDateMonths == 1);
{
totaldays1 = (31 - day1) + currentDateDays;
}
if (month1 = 12 && currentDateMonths == 2);
{
totaldays1 = (62 - day1) + currentDateDays;
}
if (month1 = 12 && currentDateMonths > 2);
{
totaldays1 = (60 - day1) + currentDateDays;
}
return totaldays1;
}
int loanTime2 ()
{
int month2, day2;
int currentDateMonths, currentDateDays, totaldays2;
if (month2 = currentDateMonths)
{
totaldays2 = (currentDateDays - day2);
}
if (month2 = (currentDateDays - day2))
{
if(month2 = 1 || 3 || 5 || 7 || 8 || 10 || 12);
{
totaldays2 = (31 - day2) + currentDateDays;
}
}
if (month2 = currentDateMonths - 2)
{
if (month2 = 1 || 2);
{
totaldays2 = (59 - day2) + currentDateDays;
}
}
if (month2 > currentDateMonths)
{
if (month2 = 11);
{
totaldays2 = (61 - day2) + currentDateDays;
}
if (month2 = 12);
{
totaldays2 = (31 - day2) + currentDateDays;
}
}
if (currentDateMonths = 1)
totaldays2 = (31 - day2) + currentDateDays;
else if(currentDateMonths = 2)
totaldays2 = (62 - day2) + currentDateDays;
else (month2 < currentDateMonths);
if (month2 = 11 && currentDateMonths == 1);
{
totaldays2 = (61 - day2) + currentDateDays;
}
if (month2 = 11 && currentDateMonths >= 2);
{
totaldays2 = 60;
}
if (month2 = 12 && currentDateMonths == 1);
{
totaldays2 = (31 - day2) + currentDateDays;
}
if (month2 = 12 && currentDateMonths == 2);
{
totaldays2 = (62 - day2) + currentDateDays;
}
if (month2 = 12 && currentDateMonths > 2);
{
totaldays2 = (60 - day2) + currentDateDays;
}
return totaldays2;
}
int loanTime3 ()
{
int month3, day3;
int currentDateMonths, currentDateDays, totaldays3;
if (month3 = currentDateMonths)
{
totaldays3 = (currentDateDays - day3);
}
if (month3 = (currentDateDays - day3))
{
if(month3 = 1 || 3 || 5 || 7 || 8 || 10 || 12);
{
totaldays3 = (31 - day3) + currentDateDays;
}
}
if (month3 = currentDateMonths - 2)
{
if (month3 = 1 || 2);
{
totaldays3 = (59 - day3) + currentDateDays;
}
}
if (month3 > currentDateMonths)
{
if (month3 = 11);
{
totaldays3 = (61 - day3) + currentDateDays;
}
if (month3 = 12);
{
totaldays3 = (31 - day3) + currentDateDays;
}
}
if (currentDateMonths = 1)
totaldays3 = (31 - day3) + currentDateDays;
else if(currentDateMonths = 2)
totaldays3 = (62 - day3) + currentDateDays;
else (month3 < currentDateMonths);
if (month3 = 11 && currentDateMonths == 1);
{
totaldays3 = (61 - day3) + currentDateDays;
}
if (month3 = 11 && currentDateMonths >= 2);
{
totaldays3 = 60;
}
if (month3 = 12 && currentDateMonths == 1);
{
totaldays3 = (31 - day3) + currentDateDays;
}
if (month3 = 12 && currentDateMonths == 2);
{
totaldays3 = (62 - day3) + currentDateDays;
}
if (month3 = 12 && currentDateMonths > 2);
{
totaldays3 = (60 - day3) + currentDateDays;
}
return totaldays3;
}
//Loan 1 Interest
int interest1 ()
{
int interest1;
int totaldays1;
if (totaldays1 < 8);
{
interest1 = (totaldays1 * 200);
}
if (totaldays1 >= 8 && totaldays1< 15);
{
interest1 = (1400 + ((totaldays1 - 7) * 400));
}
if (totaldays1 >= 15 && totaldays1 < 22);
{
interest1 = (4200 + ((totaldays1 - 14) * 600));
}
if (totaldays1 >= 22 && totaldays1 < 29);
{
interest1 = (8400 + ((totaldays1 - 21) * 800));
}
if (totaldays1 >= 29);
{
interest1 = (14000 + ((totaldays1 - 28) * 1000));
}
return interest1;
}
int interest2 ()
{
int interest2, totaldays2;
if (totaldays2 < 8);
{
interest2 = (totaldays2 * 200);
}
if (totaldays2 >= 8 && totaldays2< 15);
{
interest2 = (1400 + ((totaldays2 - 7) * 400));
}
if (totaldays2 >= 15 && totaldays2 < 22);
{
interest2 = (4200 + ((totaldays2 - 14) * 600));
}
if (totaldays2 >= 22 && totaldays2 < 29);
{
interest2 = (8400 + ((totaldays2 - 21) * 800));
}
if (totaldays2 >= 29);
{
interest2 = (14000 + ((totaldays2 - 28) * 1000));
}
return interest2;
}
int interest3 ()
{
int interest3, totaldays3;
if (totaldays3 < 8);
{
interest3 = (totaldays3 * 200);
}
if (totaldays3 >= 8 && totaldays3 < 15);
{
interest3 = (1400 + ((totaldays3 - 7) * 400));
}
if (totaldays3 >= 15 && totaldays3 < 22);
{
interest3 = (4200 + ((totaldays3 - 14) * 600));
}
if (totaldays3 >= 22 && totaldays3 < 29);
{
interest3 = (8400 + ((totaldays3 - 21) * 800));
}
if (totaldays3 >= 29);
{
interest3 = (14000 + ((totaldays3 - 28) * 1000));
}
return interest3;
}
Thanks,
yusko63