#include <iostream>
using namespace std;
struct list
{
int data;
list *next;
};
list *node, *tail = NULL, *head = NULL;
void add2list();
void extrem();
int main()
{
add2list();
extrem();
return 0;
}
void add2list()
{
int input;
cout << "Adding values to list :\n";
cout << ">>";
while(cin >> input)
{
node = new list;
node->data = input;
node->next = NULL;
if (head == NULL)
{
head = node;
tail = node;
}
else
{
tail->next = node;
tail = node;
}
cout << ">>";
}
}
void extrem()
{
int x, y;
cin >> x >> y;
}
このプログラムを実行すると、add2list関数のみが実行されます????
cin.clear()を追加しましたが、問題が解決しないのはなぜですか?
どうすればこれを解決できるかについて明確な説明をすることができます
cin.clear()オブジェクトの使用はいつ役に立ちますか?
すみません4私の悪い英語