Created
November 1, 2017 16:18
-
-
Save tina1998612/8df8c93b162df02e187feb01d251e5ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <sstream> | |
using namespace std; | |
struct Node | |
{ | |
char data; | |
Node* next; | |
}; | |
void displayList(Node* head) | |
{ | |
while(head != NULL) | |
{ | |
printf("%c", head->data); | |
head = head->next; | |
} | |
printf("\n"); | |
} | |
int main() | |
{ | |
float f; | |
while(cin>>f) | |
{ | |
stringstream ss; | |
ss << f; | |
string s = ss.str(); | |
Node* head = NULL; | |
Node* p = new Node; | |
for(int j=s.length()-1;j>=0;j--){ | |
p->data = s[j]; | |
p->next = head; | |
if(head == NULL) cout<<"yes"<<endl; | |
head = p; | |
} | |
displayList(head); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment