0

Input:24207.Output:0 2 4 7 (the order doesnt matter )

i have to writte a program that finds the digit that and delets the copies. i have no ideea how to start .I googled the problem and didnt find anything helpful. I'd like to mention that it is not homework. Thank yoy

10th Mar 2017, 10:04 AM
Hel
Hel - avatar
5 Respuestas
+ 2
#include<iostream> using namespace std; int main (){ long x, r; cin>>x; do { r = x%10; cout <<r <<" "; x = x/10; }while (x!=0); }
10th Mar 2017, 4:51 PM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar
+ 2
Devender :thank you.I tried it .it was working but it dindt delete the copy.it showed 2 twice .Thank you for your help
10th Mar 2017, 5:09 PM
Hel
Hel - avatar
+ 1
Hi Mavis, instead of deleting the copies, you could try creating a new, empty array of integers for your output. Then, for each integer in your input, add it to the output array if it doesn't already contain that integer. That way, you should end up with a new array that doesn't contain copies.
10th Mar 2017, 4:48 PM
Jamie
+ 1
Jamie .Thank you for your sugestion.Ill do my research and try .
10th Mar 2017, 5:10 PM
Hel
Hel - avatar
- 1
hh
10th Mar 2017, 10:17 AM
Ali