Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream f("date.in");
- struct nod
- {
- int info;
- nod *urm;
- };
- nod *start = NULL;
- void adaugare(int x)
- {
- nod *p;
- p->info = x;
- if(start == NULL)
- {
- start = p;
- p->urm = NULL;
- }
- else
- {
- p->urm = start;
- start = p;
- }
- }
- void afisare()
- {
- nod *p = start;
- while(p->urm != NULL)
- {
- cout << p->info;
- p = p->urm;
- }
- }
- int main()
- {
- int x;
- while(f >> x)
- {
- adaugare(x);
- }
- afisare();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement