New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus • Advice and insight from world-class Apple enthusiasts • Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Problems with terminal SSH compiling.


Post Reply New Thread Subscribe

 
Thread Tools
monolith

 
Member Since: Jan 15, 2009
Posts: 2
monolith is on a distinguished road

monolith is offline
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;
}
QUOTE Thanks
cradom

 
cradom's Avatar
 
Member Since: Feb 14, 2004
Location: Nederland, Texas
Posts: 3,072
cradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant future
Mac Specs: 21in iMac core2 Duo- 13in macbook - 10.9 on both

cradom is offline
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?

Craig Domingue - resident redneck.
“Never argue with an idiot. He will only bring you down to his level and beat you with experience.”, George Carlin
QUOTE Thanks
Dysfunction

 
Dysfunction's Avatar
 
Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,638
Dysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant future
Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff

Dysfunction is offline
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!
QUOTE Thanks
monolith

 
Member Since: Jan 15, 2009
Posts: 2
monolith is on a distinguished road

monolith is offline
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.
QUOTE Thanks
Dysfunction

 
Dysfunction's Avatar
 
Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,638
Dysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant future
Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff

Dysfunction is offline
is there an error that you get when you try to exit and compile?

mike
This machine kills fascists
Got # ? phear the command line!
QUOTE Thanks
cradom

 
cradom's Avatar
 
Member Since: Feb 14, 2004
Location: Nederland, Texas
Posts: 3,072
cradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant future
Mac Specs: 21in iMac core2 Duo- 13in macbook - 10.9 on both

cradom is offline
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?

Craig Domingue - resident redneck.
“Never argue with an idiot. He will only bring you down to his level and beat you with experience.”, George Carlin
QUOTE Thanks
rman

 
rman's Avatar
 
Member Since: Dec 24, 2002
Location: Los Angeles, California
Posts: 12,591
rman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud of
Mac 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

rman is offline
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!
QUOTE Thanks
Dysfunction

 
Dysfunction's Avatar
 
Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,638
Dysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant future
Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff

Dysfunction is offline
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!
QUOTE Thanks

Post Reply New Thread Subscribe


« Open files with my new Application | Taking up Cocoa »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Aqua Connect Terminal Server Josh Trenor OS X - Apps and Games 2 03-12-2009 06:44 PM
iMac + MacBook MacBookPro Internet Connection Problems stevend Internet, Networking, and Wireless 2 10-05-2008 11:19 AM
Problems with leopard an gael cliste OS X - Operating System 2 09-18-2008 09:37 AM
New 24" Penryn iMac...problems from day one:( coolmel Apple Desktops 7 06-22-2008 03:33 AM
The mysterious Terminal Kokopelli OS X - Operating System 2 03-05-2006 08:23 AM

All times are GMT -4. The time now is 03:36 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?