#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對象 - C++
我已經添加了cin.clear(),但問題沒有解決,爲什麼?
somecan得到約如何解決這個
和當是利用cin.clear的()對象有用清楚explaintion ??
對不起4我的英語不好
你怎麼知道極端的ISN沒有被執行?它什麼都不做? – Antimony 2012-08-16 00:20:16