Results 1 to 8 of 8
  1. #1


    Member Since
    Jan 15, 2009
    Posts
    2
    Problems with terminal SSH compiling.
    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;
    }

  2. #2

    cradom's Avatar
    Member Since
    Feb 14, 2004
    Location
    Groves, Texas
    Posts
    4,611
    Specs:
    21in. iMac 10.11 --- HP Linux Mint 18
    Is nano not letting you exit? After doing the control-o are you typing control-x?
    Or are you having problems with the compile in the shell?
    One manís theology is another manís belly laugh.
    -Lazarus Long

  3. #3

    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Location
    Tucson, AZ
    Posts
    6,881
    Specs:
    Way... way too many specs to list.
    nano is a pico clone (but it is installed by default in os x), pico's only going to be installed (usually) if you've installed pine as a mail reader. While I don't use either much (I prefer vi), when I do I use ctrl-x to exit and save it when prompted to.
    mike
    This machine kills fascists
    Got # ? phear the command line!

  4. #4


    Member Since
    Jan 15, 2009
    Posts
    2
    Yes, after pushing control-x, it will not let me exit. As well, When prompting it to compile, by typing: g++ prog1.cpp it will not compile.

  5. #5

    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Location
    Tucson, AZ
    Posts
    6,881
    Specs:
    Way... way too many specs to list.
    is there an error that you get when you try to exit and compile?
    mike
    This machine kills fascists
    Got # ? phear the command line!

  6. #6

    cradom's Avatar
    Member Since
    Feb 14, 2004
    Location
    Groves, Texas
    Posts
    4,611
    Specs:
    21in. iMac 10.11 --- HP Linux Mint 18
    When you do a control-x do you get a shell prompt? Or are you still in nano?
    Dumb question, you DO have xcode installed on your ibook right?
    One manís theology is another manís belly laugh.
    -Lazarus Long

  7. #7

    rman's Avatar
    Member Since
    Dec 24, 2002
    Location
    Los Angeles, California
    Posts
    12,584
    Specs:
    2 x 3.0GHz Quad-Core, 6GB OS X 10.6.8 | 15in MacBook Pro 2.2GHz OS X 10.6.8 | 64GB iPad 2 WiFi
    Cool
    I would use the vi editor, since it comes with every favor of Unix operating system.
    Life isn't about waiting for the storm to pass, It's about learning to dance in the rain!

  8. #8

    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Location
    Tucson, AZ
    Posts
    6,881
    Specs:
    Way... way too many specs to list.
    Quote Originally Posted by rman View Post
    I would use the vi editor, since it comes with every favor of Unix operating system.
    I agree, but then we run into having a very non-user friendly text editor.. and I use vi daily and love it.. but people who don't know it using it (especially in /etc) scares the bejesus outa me
    mike
    This machine kills fascists
    Got # ? phear the command line!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. SSH in Terminal, cursor goes crazy and overwrites text
    By edokid in forum OS X - Apps and Games
    Replies: 4
    Last Post: 01-28-2012, 11:07 AM
  2. SSH with Terminal
    By Basil Fawlty in forum Switcher Hangout
    Replies: 7
    Last Post: 06-02-2011, 06:52 PM
  3. SSH Login w/ Terminal
    By PrimalYeti in forum OS X - Development and Darwin
    Replies: 1
    Last Post: 07-28-2009, 12:13 AM
  4. terminal compiling help
    By SARDONIC_MATH in forum OS X - Development and Darwin
    Replies: 2
    Last Post: 04-22-2009, 11:29 AM
  5. Delete key not emulating right in ssh'd terminal
    By n0r1 in forum OS X - Apps and Games
    Replies: 2
    Last Post: 03-13-2005, 07:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •