When I run the program from: /Macintosh HD/Users/MYNAME/Desktop/Stuff/Coding/Codeblocks/Calculate/bin/Debug it produces this:
Last login: Sat Jul 15 18:12:06 on ttys002
mbastudent122:~ MYNAME$ /Users/MYNAME/Desktop/Stuff/Coding/Codeblocks/Calculate/bin/Debug/Calculate ; exit;
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
The path only contains whitespace in the volume name but it's been like that since I got the macbook and it used to work.
Steps:
1. I wrote a program with:
#include <iostream>
using namespace std;
void calculator()
{
float num1, num2, log;
char Operator, answer;
cout << "Input an equation (e.g. 1+2) using operators +, -, * or /" << endl;
cin >> num1 >> Operator >> num2;
switch (Operator) {
case '+':
log = num1 + num2;
break;
case '-':
log = num1 - num2;
break;
case '*':
log = num1 * num2;
break;
case '/':
log = num1 / num2;
break;
}
cout << log << endl;
cout << "--------------------------------------------------------------------------------------" << endl;
cout << "Would you like to continue? (y or n)" << endl;
cin >> answer;
if (answer == 'y')
do {
float num1, num2, log;
char Operator, answer;
cout << "Input an equation (e.g. 1+2) using operators +, -, * or /" << endl;
cin >> num1 >> Operator >> num2;
switch (Operator) {
case '+':
log = num1 + num2;
break;
case '-':
log = num1 - num2;
break;
case '*':
log = num1 * num2;
break;
case '/':
log = num1 / num2;
break;
}
cout << log << endl;
cout << "--------------------------------------------------------------------------------------" << endl;
cout << "Would you like to continue? (y or n)" << endl;
cin >> answer;
}
while (answer == 'y');
cout << "Understandable, have a great day!" << endl;
}
int main()
{
calculator;
return 0;
}
2. I hit compile - No errors
3. I hit run and a terminal window came up showing:
Last login: Sat Jul 15 18:12:37 on ttys002
/private/var/folders/f2/qjwg6b011tdbxr47v8g3m3bnr_y7jw/T/AppTranslocation/C55E393A-AFDF-44DE-B4E0-5E86D812235A/d/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/MYNAME/Desktop/Stuff/Coding/Codeblocks/Calculate/bin/Debug/Calculate
mbastudent122:~ MYNAME$ /private/var/folders/f2/qjwg6b011tdbxr47v8g3m3bnr_y7jw/T/AppTranslocation/C55E393A-AFDF-44DE-B4E0-5E86D812235A/d/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/MYNAME/Desktop/Stuff/Coding/Codeblocks/Calculate/bin/Debug/Calculate
Process returned 0 (0x0) execution time : 0.035 s
Press ENTER to continue.
Since my last post, it has actually changed and I have no idea why. Don't ask me because I don't have an answer.