実行押すと止まります。

フォーラム(掲示板)ルール
フォーラム(掲示板)ルールはこちら  ※コードを貼り付ける場合は [code][/code] で囲って下さい。詳しくはこちら
テマリ

実行押すと止まります。

#1

投稿記事 by テマリ » 13年前

Microsoft Visual C++ 2010 ExpressでフォームアプリケーションというのでC++を使ってみたんですがビルドして実行ボタンを押すと止まってしまいます。
PCが重いだけでしょうか?
ついでなんですがコンパイラとMicrosoft Visual C++ 2010 Expressみたいなソフトを作るには何言語で作れるか教えてください。

コード:

#pragma once
int a [10];
int b[10][10];
int c[10][10];

namespace d {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Form1 の概要
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: ここにコンストラクター コードを追加します
			//
		}

	protected:
		/// <summary>
		/// 使用中のリソースをすべてクリーンアップします。
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::Button^  button1;
	protected: 
	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::Label^  label2;
	private: System::Windows::Forms::Label^  label3;
	private: System::Windows::Forms::Label^  label4;
	private: System::Windows::Forms::Label^  label5;
	private: System::Windows::Forms::Label^  label6;
	private: System::Windows::Forms::Label^  label7;

	private:
		/// <summary>
		/// 必要なデザイナー変数です。
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// デザイナー サポートに必要なメソッドです。このメソッドの内容を
		/// コード エディターで変更しないでください。
		/// </summary>
		void InitializeComponent(void)
		{
			this->button1 = (gcnew System::Windows::Forms::Button());
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->label2 = (gcnew System::Windows::Forms::Label());
			this->label3 = (gcnew System::Windows::Forms::Label());
			this->label4 = (gcnew System::Windows::Forms::Label());
			this->label5 = (gcnew System::Windows::Forms::Label());
			this->label6 = (gcnew System::Windows::Forms::Label());
			this->label7 = (gcnew System::Windows::Forms::Label());
			this->SuspendLayout();
			// 
			// button1
			// 
			this->button1->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 18, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(128)));
			this->button1->Location = System::Drawing::Point(12, 12);
			this->button1->Name = L"button1";
			this->button1->Size = System::Drawing::Size(81, 36);
			this->button1->TabIndex = 0;
			this->button1->Text = L"実行";
			this->button1->UseVisualStyleBackColor = true;
			this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(128)));
			this->label1->Location = System::Drawing::Point(22, 73);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(52, 16);
			this->label1->TabIndex = 1;
			this->label1->Text = L"label1";
			// 
			// label2
			// 
			this->label2->AutoSize = true;
			this->label2->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(128)));
			this->label2->Location = System::Drawing::Point(156, 25);
			this->label2->Name = L"label2";
			this->label2->Size = System::Drawing::Size(52, 16);
			this->label2->TabIndex = 2;
			this->label2->Text = L"label2";
			// 
			// label3
			// 
			this->label3->AutoSize = true;
			this->label3->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(128)));
			this->label3->Location = System::Drawing::Point(300, 25);
			this->label3->Name = L"label3";
			this->label3->Size = System::Drawing::Size(52, 16);
			this->label3->TabIndex = 3;
			this->label3->Text = L"label3";
			// 
			// label4
			// 
			this->label4->AutoSize = true;
			this->label4->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(128)));
			this->label4->Location = System::Drawing::Point(156, 176);
			this->label4->Name = L"label4";
			this->label4->Size = System::Drawing::Size(52, 16);
			this->label4->TabIndex = 4;
			this->label4->Text = L"label4";
			// 
			// label5
			// 
			this->label5->AutoSize = true;
			this->label5->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(128)));
			this->label5->Location = System::Drawing::Point(300, 176);
			this->label5->Name = L"label5";
			this->label5->Size = System::Drawing::Size(52, 16);
			this->label5->TabIndex = 5;
			this->label5->Text = L"label5";
			// 
			// label6
			// 
			this->label6->AutoSize = true;
			this->label6->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(128)));
			this->label6->Location = System::Drawing::Point(156, 221);
			this->label6->Name = L"label6";
			this->label6->Size = System::Drawing::Size(52, 16);
			this->label6->TabIndex = 6;
			this->label6->Text = L"label6";
			// 
			// label7
			// 
			this->label7->AutoSize = true;
			this->label7->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(128)));
			this->label7->Location = System::Drawing::Point(300, 221);
			this->label7->Name = L"label7";
			this->label7->Size = System::Drawing::Size(52, 16);
			this->label7->TabIndex = 7;
			this->label7->Text = L"label7";
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(471, 460);
			this->Controls->Add(this->label7);
			this->Controls->Add(this->label6);
			this->Controls->Add(this->label5);
			this->Controls->Add(this->label4);
			this->Controls->Add(this->label3);
			this->Controls->Add(this->label2);
			this->Controls->Add(this->label1);
			this->Controls->Add(this->button1);
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
				 int i;
				 int j;
				 String^w="";
				 for(i=0;i<10;i++){
					 a[i]=i;
				 }
				 for(i=0;i<10;i++){
					 w=w+L" "+a[i].ToString();
				 }
				 label1->Text=w;
				 w=L"";
				 for(i=0;i<4;i++){
					 for(j=0;j<4;j++){
						 b[i][j]=4*i+j+5;
					 }
				 }
				 for(i=0;i<4;i++){
					 for(j=0;j<4;j++){
						 if(b[i][j]<10){
							 w=w+L"0"+b[i][j].ToString()+L" ";
						 }
						 else{
							 w=w+b[i][j].ToString()+L" ";
						 }
					 }
					 w=w+L"\n";
				 }
				 label2->Text=w;
				 w=L"";
				 for(i=0;i<4;i++){
					 for(j=0;j<4;j++){
						 c[i][j]=4*i+j;
					 }
				 }
				 for(i=0;i<4;j++){
					 for(j=0;j<4;j++){
						 if(c[i][j]<10){
							 w=w+L"0"+c[i][j].ToString()+L" ";
						 }
						 else{
							 w=w+c[i][j].ToString()+L" ";
						 }
					 }
					 w=w+L"\n";
				 }
				 label3->Text=w;
				 label4->Text=L"和";
				 label5->Text=L"差";
				 w=L"";
				 for(i=0;i<4;i++){
					 for(j=0;j<4;j++){
						 if(b[i][j]+c[i][j]<10){
							 w=w+L"0"+(b[i][j]+c[i][j]).ToString()+L" ";
						 }
						 else{
							 w=w+(b[i][j]+c[i][j]).ToString()+L" ";
						 }
					 }
					 w=w+L"\n";
				 }
				 label6->Text=w;
				 w=L"";
				 for(i=0;i<4;i++){
					 for(j=0;j<4;j++){
						 if(b[i][j]-c[i][j]<10){
							 w=w+L"0"+(b[i][j]-c[i][j]).ToString()+L" ";
						 }
						 else{
							 w=w+(b[i][j]-c[i][j]).ToString()+L" ";
						 }
					 }
					 w=w+L"\n";
				 }
				 label7->Text=w;
			 }
	};
}

アバター
softya(ソフト屋)
副管理人
記事: 11677
登録日時: 15年前
住所: 東海地方
連絡を取る:

Re: 実行押すと止まります。

#2

投稿記事 by softya(ソフト屋) » 13年前

Microsoft Visual C++ 2010 Expressが私のPCで動かないのでついでの質問だけお答えします。

>ついでなんですがコンパイラとMicrosoft Visual C++ 2010 Expressみたいなソフトを作るには何言語で作れるか教えてください。

コンパイラはC言語やC++で作られるいるものが多いと思います。
Microsoft Visual C++ 2010 Express自体はC#かC++/CLIやC++など複合された製品だと思います。
ただし、個人一人で同じ物を作るとしたら10年でも足らないと思います。
もっとIDEを簡易にしたり、コンパイラ自体を簡単にすれば数年で作れると思いますよ。
それでも言語以外にも沢山勉強する必要がありますね。
by softya(ソフト屋) 方針:私は仕組み・考え方を理解して欲しいので直接的なコードを回答することはまれですので、すぐコードがほしい方はその旨をご明記下さい。私以外の方と交代したいと思います(代わりの方がいる保証は出来かねます)。

テマリ

Re: 実行押すと止まります。

#3

投稿記事 by テマリ » 13年前

返信ありがとうございます。
使っているオススメのC++コンパイラ?とアセンブラが何言語で作られてるのか教えてもらえませんか?

アバター
softya(ソフト屋)
副管理人
記事: 11677
登録日時: 15年前
住所: 東海地方
連絡を取る:

Re: 実行押すと止まります。

#4

投稿記事 by softya(ソフト屋) » 13年前

テマリ さんが書きました:返信ありがとうございます。
使っているオススメのC++コンパイラ?とアセンブラが何言語で作られてるのか教えてもらえませんか?
私はVC++2008ですが、これじゃなきゃダメということはないと無いと思います。
Eclipseでも良いですし、Mingwを直に使ってもよいでしょう。
それとGUIを作るライブラリ/フレームワークと開発用のプログラミング言語は各々検討すべき問題ですので一緒に考えないほうが良いでしょう。

コンパイラはC言語で作って、GUI部分はVBで作っても構わない問題です。

>アセンブラが何言語で作られてるのか

アセンブラ言語の翻訳プログラムの事ですよね?
これは先程のコンパイラと同じ答えです。
by softya(ソフト屋) 方針:私は仕組み・考え方を理解して欲しいので直接的なコードを回答することはまれですので、すぐコードがほしい方はその旨をご明記下さい。私以外の方と交代したいと思います(代わりの方がいる保証は出来かねます)。

テマリ

Re: 実行押すと止まります。

#5

投稿記事 by テマリ » 13年前

ありがとうございました。

アバター
softya(ソフト屋)
副管理人
記事: 11677
登録日時: 15年前
住所: 東海地方
連絡を取る:

Re: 実行押すと止まります。

#6

投稿記事 by softya(ソフト屋) » 13年前

テマリ さんが書きました:ありがとうございました。
えーと、動かない件は良いのですか?
by softya(ソフト屋) 方針:私は仕組み・考え方を理解して欲しいので直接的なコードを回答することはまれですので、すぐコードがほしい方はその旨をご明記下さい。私以外の方と交代したいと思います(代わりの方がいる保証は出来かねます)。

テマリ

Re: 実行押すと止まります。

#7

投稿記事 by テマリ » 13年前

忘れてました。
解決押してしまったので作り直して何とかやってみます。

閉鎖

“C言語何でも質問掲示板” へ戻る