I am using netbeans 6.8:
Product Version: NetBeans IDE 6.8 (Build 200912041610)
Java: 1.6.0_18; Java HotSpot(TM) Client VM 16.0-b13
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\Users\Andre\.netbeans\6.8
I have copied a program out of a book I am using to do C++ self study. Here is the code:
/*
* File: main.cpp
* Author: Andre
*
* Created on December 5, 2011, 2:06 PM
*/
#include <iostream>
#include <string>
//using namespace std;
using std::cin;
using std::endl;
using std::cout;
using std::string;
int main() {
// ask for the persons name
std::string name;
cin >> name;
// build the message that we intend to write
const string greeting = "Hello, " + name + "!";
// the number of blanks surrounding the greeting
const int pad = 1;
// the number of rows and columns to write
const int rows = pad * 2 + 3;
const string::size_type cols = greeting.size() + pad * 2 + 2;
// write a blank line to separate the output from the input
cout << endl;
// write rows "rows of output"
// invariant: we have written r rows so far
for (int r = 0; r != rows; ++r) {
string::size_type c = 0;
// invariant: we have written c characters so far in the current row
while (c != cols) {
// is it time to write the greeting?
if (r == pad + 1 && c == pad + 1) {
cout << greeting.size();
} else {
// are we on the border?
if (r == 0 || r == rows - 1 || c == 0 || c == cols - 1) {
cout << "*";
} else {
cout << " ";
++c;
}
}
}
}
return 0;
}
Here is the build results:
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .clean-conf
make[1]: Entering directory `/d/Users/Andre/Documents/NetBeansProjects/AccCpp20'
rm -f -r build/Debug
rm -f dist/Debug/MinGW-Windows/acccpp20.exe
make[1]: Leaving directory `/d/Users/Andre/Documents/NetBeansProjects/AccCpp20'
CLEAN SUCCESSFUL (total time: 569ms)
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/d/Users/Andre/Documents/NetBeansProjects/AccCpp20'
/usr/bin/make -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/acccpp20.exe
make[2]: Entering directory `/d/Users/Andre/Documents/NetBeansProjects/AccCpp20'
mkdir -p build/Debug/MinGW-Windows
rm -f build/Debug/MinGW-Windows/main.o.d
g++ -c -g -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
mkdir -p dist/Debug/MinGW-Windows
g++ -o dist/Debug/MinGW-Windows/acccpp20 build/Debug/MinGW-Windows/main.o
make[2]: Leaving directory `/d/Users/Andre/Documents/NetBeansProjects/AccCpp20'
make[1]: Leaving directory `/d/Users/Andre/Documents/NetBeansProjects/AccCpp20'
BUILD SUCCESSFUL (total time: 1s)
When I run the program I get a message in the output area of netbeans that says "Process is starting in external window..." and a terminal window that pops up with "C:\msys\1.0\bin\sh.exe with just a blank screen and blinking cursor.
When I did a simple program just printing out "Hi!" it works fine. What is going on with this??
Also, how do I do a code block posting a question?? The tutorial said something about 4 spaces…
Its waiting for you to type in your name and press enter.. at which point it should continue running. If you want it to ask you to do this you need to do something like: