Hello,
I just started to teach myself to program in the C++ language and i have just finished writing my first program with an actual function but I'm wondering how i run the program without Xcode.
So my question is basically can i run this program on my Mac (or any other Macs) without having to run it with Xcode or any other comparable compiler every single time?
I'm using Xcode 2.5 with Mac Os X v.10.4.11 (Tiger)
and my programming code looks like this: (don't worry about not understanding the "couts" English isn't my native language so i didn't write it in English.)
#include <iostream>
#include <math.h>
using namespace std;
int main ()
{
int a;
int b, b1;
int c;
int result0, result1, result2, result3, result4;
int result00, result01, result02, result03, result04;
cout << "Þú ert kominn í Samband við Hakkavélina" << endl;
cout << "Þessi hakkavél getu reiknað núllpunkta annars stigs formúla á forminu: ";
cout << "Ax^2 + Bx + C" << endl << "..." <<endl;
cout << "Skrifið inn stærð fyrir A, og ýtið svo á Enter" << endl;
cin >> a;
cout << "Skrifið inn stærð fyrir B, og ýtið svo á Enter" << endl;
cin >> b;
cout << "Skrifið inn stærð fyrir C, og ýtið svo á Enter" << endl;
cin >> c;
b1 = b * -1;
result0 = 4 * a * c;
result1 = b*b - result0;
result2 = sqrt (result1);
result3 = b1 + result2;
result4 = result3 / (2 * a);
result00 = 4 * a * c;
result01 = b*b - result00;
result02 = sqrt (result01);
result03 = b1 - result02;
result04 = result03 / (2 * a);
cout << "Svar:" << endl;
cout << result4 << " eða " << result04;
return 0;
}
I know it ain't a great program but it works. Don't know if you understand it's function from this code but what it does is calculating the value of "x" in formulas like: Ax^2 + Bx + C , when the final value is supposed to be 0. Don't really know how to say that in mathematical therms in English.
So once again: Can i run this program like any other application on Macs and then how?
Thank you for your time.
I just started to teach myself to program in the C++ language and i have just finished writing my first program with an actual function but I'm wondering how i run the program without Xcode.
So my question is basically can i run this program on my Mac (or any other Macs) without having to run it with Xcode or any other comparable compiler every single time?
I'm using Xcode 2.5 with Mac Os X v.10.4.11 (Tiger)
and my programming code looks like this: (don't worry about not understanding the "couts" English isn't my native language so i didn't write it in English.)
#include <iostream>
#include <math.h>
using namespace std;
int main ()
{
int a;
int b, b1;
int c;
int result0, result1, result2, result3, result4;
int result00, result01, result02, result03, result04;
cout << "Þú ert kominn í Samband við Hakkavélina" << endl;
cout << "Þessi hakkavél getu reiknað núllpunkta annars stigs formúla á forminu: ";
cout << "Ax^2 + Bx + C" << endl << "..." <<endl;
cout << "Skrifið inn stærð fyrir A, og ýtið svo á Enter" << endl;
cin >> a;
cout << "Skrifið inn stærð fyrir B, og ýtið svo á Enter" << endl;
cin >> b;
cout << "Skrifið inn stærð fyrir C, og ýtið svo á Enter" << endl;
cin >> c;
b1 = b * -1;
result0 = 4 * a * c;
result1 = b*b - result0;
result2 = sqrt (result1);
result3 = b1 + result2;
result4 = result3 / (2 * a);
result00 = 4 * a * c;
result01 = b*b - result00;
result02 = sqrt (result01);
result03 = b1 - result02;
result04 = result03 / (2 * a);
cout << "Svar:" << endl;
cout << result4 << " eða " << result04;
return 0;
}
I know it ain't a great program but it works. Don't know if you understand it's function from this code but what it does is calculating the value of "x" in formulas like: Ax^2 + Bx + C , when the final value is supposed to be 0. Don't really know how to say that in mathematical therms in English.
So once again: Can i run this program like any other application on Macs and then how?
Thank you for your time.