I have a CS 161 assignment due tomorrow and I am using terminal to log into SSH on my Mac IBook G4. I have written the program but when getting to the end and typing control O to write the program, it is not letting me exit once there. I tried typing g++ prog1.cpp to compile and it does nothing. The program itself is very simple and I have looked it over for mistakes and can find none. I am using nano. I tried using pico but I received an error message. Can anyone help with this? Below is what I have typed for my program. Thanks!
//Header file
#include <iostream>
using namespace std;
//Named constants
const int HALFDOLLAR = 50;
const int QUARTER = 25;
const int DIME = 10;
const int NICKEL = 5;
int main()
{
//Declare variable
int change;
//Statements: Step 1- Step 12
cout << "Enter change in cents: "; // Step 1
cin >> change; // Step 2
cout << endl;
cout << "The change you entered is " << change
<< endl; // Step 3
cout << "The number of half-dollars to be returned "
<< " is " << change / HALFDOLLAR
<< endl; // Step 4
change = change % HALFDOLLAR; // Step 5
cout << "The number of quarters to be returned is "
<< change / QUARTER << endl; // Step 6
change = change % QUARTER; // Step 7
cout << "The number of dimes to be returned is "
<< change / DIME << endl; // Step 8
change = change % DIME; // Step 9
cout << "The number of nickels to be returned is "
<< change / NICKEL << endl; // Step 10
change = change % NICKEL; // Step 11
cout << "The number of pennies to be returned is "
<< change << endl; // Step 12
0;
}
//Header file
#include <iostream>
using namespace std;
//Named constants
const int HALFDOLLAR = 50;
const int QUARTER = 25;
const int DIME = 10;
const int NICKEL = 5;
int main()
{
//Declare variable
int change;
//Statements: Step 1- Step 12
cout << "Enter change in cents: "; // Step 1
cin >> change; // Step 2
cout << endl;
cout << "The change you entered is " << change
<< endl; // Step 3
cout << "The number of half-dollars to be returned "
<< " is " << change / HALFDOLLAR
<< endl; // Step 4
change = change % HALFDOLLAR; // Step 5
cout << "The number of quarters to be returned is "
<< change / QUARTER << endl; // Step 6
change = change % QUARTER; // Step 7
cout << "The number of dimes to be returned is "
<< change / DIME << endl; // Step 8
change = change % DIME; // Step 9
cout << "The number of nickels to be returned is "
<< change / NICKEL << endl; // Step 10
change = change % NICKEL; // Step 11
cout << "The number of pennies to be returned is "
<< change << endl; // Step 12
0;
}