掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
実行エラー (ID:56048)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
このプログラムをコンパイルして名前を入力すると、実行エラーがでます。 なぜでしょうか? コンパイラー Visual C++ 後実行させたい事は、生徒の名前と年を入力させて、表示させたいんです。 #include <iostream.h> #include <string.h> #include <stdlib.h> //Demographic class class Demographic{ int age; char *name; public: Demographic( char *s, int a ){strcpy(name,s); age = a;} void call(){cout << "\t Student Name is " << name << endl; cout << "\t Student Age is " << age << endl;} }; //Generation Class class Generation{ public: Generation(){}; void Make(); }; void Generation::Make(){ char *StName = "0"; int StAge; cout << "\t Please enter your students' name and age." << endl; cout << "\t Student Name :: "; cin >> StName; cout << "\n\t Student Age ::"; cin >> StAge; Demographic St( StName,StAge ); system("cls"); St.call(); } int main(){ Generation A; A.Make(); return 0; }
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.