#include <iostream> using namespace std; class Cell { private: int data; Cell *next; public: Cell( int dataValue ); void connect( Cell *nextPtr ); void show( ); }; Cell::Cell( int dataValue ) { data = dataValue; next = NULL; } void Cell::connect( Cell *nextPtr ) { // その1 } void Cell::show( ) { // その2 } int main( ) { Cell cellA(1); Cell cellB(2); Cell cellC(3); cellB.show(); cellB.connect(&cellA); cellB.show(); cellC.connect(&cellB); cellC.show(); return 0; }
実行画面
2
21
321
実行画面のようにリストを出力したいのですが、その1とその2の関数はどう定義すれば良いのでしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。