I'm currently learning how to code in c++ and taking a course on it in school.
My problem/question is how do you transfer code so it compiles correctly from a windows machine to a linux machine.
My assignment in finished and compiles correctly on my computer using "microsoft visual c++ 2010 express", problem is my teacher has a linux machine and he tests the code on that machine. When I tried compiling my code on a linux machine I ended up with an error log that made no sense to me. My guess is that the linux machine doesn't have access to all the libraries I used, if so how do I fix this so I can turn my assignment in?
here is my code
#include "stdafx.h"
#include <iostream>
using namespace std;
double ask_p (double);
void display (double,double,double);
void f_month (double, double);
void n_month (double,double,double);
int main()
{
const double r = 0.22;
double b = 5000.00;
double P = ask_p(P);
display(r,b,P);
f_month (r,B)/>;
n_month (r,b,P);
system("pause");
return 0;
}
double ask_p(double P)
{
cout << "Enter your monthly payment: ";
cin >> P;
cout << endl;
return P;
}
void display (double r, double b, double P)
{
cout << "r = " << r << endl;
cout << "b = " << b << endl;
cout << "P = " << P << endl;
}
void f_month (double r, double B)/>
{
double fm = (r/12)*b;
cout << "1 " << fm << " " << b << endl;
}
void n_month (double r, double b, double P)
{
double fm = (r/12)*b;
double h = (r/12)*b;
int c = 2;
double paid = (b-P+fm);
double total = fm;
double n_month = (r/12)*(b-P+fm);
while (paid > 0){
cout << c << " " << n_month << " " << paid << endl;
fm = n_month;
b = paid;
n_month = (r/12)*(b-P+fm);
paid = (b-P+fm);
total = total + n_month;
c++;
}
total = total + h;
cout << total << endl;
}

New Topic/Question
This topic is locked



MultiQuote


|