| title | date | excerpt | tags | privacy | ||
|---|---|---|---|---|---|---|
Untitled Post |
2026-02-21 |
``` #include <bits/stdc++.h> using namespace std; struct Node { int data; Node* next;
N |
|
public |
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node* next;
Node(int x){
data =x;
next = nullptr;
}
};
int main(){
srand(time(0)); // Seed the random number generator
Node* head = new Node(10);
Node* temp = head;
for(int i=0;i<10;i++){
temp->next = new Node(rand()%100);
temp = temp -> next;
}
Node* temp2 = head;
while(temp2 != nullptr){
cout<<temp2->data<<endl;
temp2 = temp2 -> next;
}
// return 0;
}