-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path单行多数字.cpp
48 lines (39 loc) · 836 Bytes
/
单行多数字.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
struct DoubleListNode
{
double val;
DoubleListNode *next;
};
int main()
{
double a;
DoubleListNode *head = new DoubleListNode();
head->next = NULL;
long length = 0;
DoubleListNode *latest = head;
while (cin >> a)
{
DoubleListNode *newNode = new DoubleListNode();
newNode->next = NULL;
latest->val = a;
latest->next = newNode;
latest = newNode;
length++;
if (cin.get() == '\n')
break;
}
DoubleListNode *current = head;
double* num = new double[length];
int index = 0;
while (current->next != NULL)
{
num[index] = current->val;
current = current->next;
index++;
}
// TODO
return 0;
}