내가 사용하고 넷빈즈 6.8 :왜 netbeans 내 간단한 프로그램을 실행 막혀 점점?
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
나는 C++ 자체 연구를 수행하는 사용하고 책에서 프로그램을 복사 한. 여기
/*
* 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;
}
빌드 결과입니다 : 여기에 코드입니다
/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)
나는이 프로그램을 실행하면 나는 "Process is starting in external window..."
및 팝업 터미널 창을 말한다 넷빈즈의 출력 영역에 메시지를 얻을 수 "C:\msys\1.0\bin\sh.exe
에는 빈 화면과 깜박이는 커서 만 있습니다.
간단한 프로그램을 만들었을 때 "Hi!"
을 인쇄했을 때 잘 동작합니다. 이것으로 무슨 일이 일어나고있는거야 ??
또한 질문을 게시하는 코드 블록을 어떻게 수행합니까 ?? 튜토리얼은 4 칸 정도의 공간을 말했습니다 ...
이름을 입력하고 Enter 키를 누를 때까지 기다리는 중입니다 .. – StevieG
내가 틀렸다면 정정하십시오. 그러나 첫 번째 진술이 Cin 인 경우 커서가있는 빈 화면을 가져 오지 않아야합니까? 뭔가를 입력하면 어떻게됩니까? – SuperTron
바보 같은 기분에 대해 이야기하십시오. :) 분명히 책에는 "Please name your name"줄이 있습니다! 코드에서 또 다른 라인을 놓쳤습니다. 나는 현재 내 이름을 입력하고 엔터를 누르면 계속해서 "*"를 반복해서 인쇄하는 새로운 문제가있다. 어딘가에 다른 오류가 있어야합니다. 두 개의 누락 된 선을 추가하기 전에 이렇게했습니다. – DemiSheep