Предмет: Информатика, автор: 1218vados

20 баллов!!! c++
Цифры числа.
Дано 10-значное число. Выведите все цифры этого числа в обратном порядке по одной.

Входные данные

На вход подаётся натуральное 10-значное число.

Выходные данные

Выведите ответ на задачу. В качестве разделителя между цифрами можно использовать переводы строки и пробелы.

Ответы

Автор ответа: Аноним
2

Ответ:

int main(int argc, char *argv[]) {

int n;

std::cin >> n;

std::vector<int> ivec;

while (n) {

ivec.push_back(n % 10);

n /= 10;

}

std::copy(ivec.rbegin(),

ivec.rend(),

std::ostream_iterator<int>(std::cout, " "));

return 0;

}


1218vados: нужно через цикл for
1218vados: реши через цикл for пожалуйста
Аноним: изивините, однако, в задании нужно было указать, у меня нет времени переделывать.
Автор ответа: restIess
1

#include <iostream>

using namespace std;

int main() {

int n;

cin >> n;

n = abs(n);

while (n > 0) {

 cout << n % 10 << " ";

 n /= 10;

}

return 0;

}


1218vados: не засчитывает
restIess: не засчитывает мне ни о чем не говорит, мне входные данные при которых программа выдает ошибку
exasaev2004: при вводе 0987654321 выводит все, кроме нуля
exasaev2004: #include
using namespace std;
int main() {
int n;
cin >> n;
n = abs(n);
while (n > 0 ) {
cout << n % 10 <<" ";
n /= 10;
if (n==0)
cout << 0 << " ";
}
}
exasaev2004: полностью решается так( костыли еб****е)
Похожие вопросы
Предмет: Английский язык, автор: t0421
Помогите с тестом
1. It … be useful for you if you … this task a second time.
a. would, did
b. will, ‘ll do
c.would, had done
d. would, would do
2. You … never say he was boring if you … to him more.
a.will, will talk
b.would, would talk
c.would, talked
d.would ,will talk
3. If you … that she … upset you … never … her about it.
a.Would realize, would be, would, have told
b.Had realized, will be, would, have told
c.Had realized, would be, would, have told
d.Had realized, would be, will, tell
4. If this novel … more interesting, it … published.
a.will be, would be
b.were, will be
c.would be, would be
d.were, would be
5. If my friend … not away, he … me round the city.
a.won’t be, could show
b.were, could show
c.is, could have shown
d.will be, could show
6. If the weather … fine tomorrow, I … to the beach.
a.were, would go
b.would be, would go
c.will be would go
d.were, ‘ll go
7. If she … more working experience, she wouldn’t have been fired
a.would have
b.had had
c.had
d.has
8. If I had known that I … put off the trip.
a.would
b.would have
c.will
d.had
9. If I … you, I would never give up.
a.were
b.was
c.am
d.have been
10. If my grandmother … a chance to study, she’d have achieved a lot.
a.has
b.had
c.had had
d.would have
11. If he’d come two minutes later, we … the plane.
a.had missed
b.would miss
c.will miss
d.would have missed
12. If I had had more money on me yesterday I … that lovely dress.
a.could buy
b.could have bought
c.‘ll buy
d.bought
13. If I … she was in trouble I could have tried to help her.
a.know
b.knew
c.had known
d.‘ll know
14. If you had studied harder last year, you … all exams.
a.would have passed
b.would pass
c.passed
d.had passed
15. If Ivanov were more attentive, he … better.
a.had done
b.will do
c.would do
d.did
16. He … angry if you didn’t come to the party.
a.is
b.would be
c.will be
d.can be
17. What would you do if your friend … in trouble?
a.are
b.will be
c.is
d.were
18. If you had kept this fruit in fridge, it … bad.
a.wouldn’t have gone
b.won’t go
c.hadn’t gone
d.wouldn’t go
19. If he were well bred, he … like that.
a.didn’t behave
b.wouldn’t behave
c.hasn’t behaved
d.hadn’t behaved
20. What would you have done, if you … the exam?
a.‘ll fail
b.fail
c.had failed
d.would fail
21. He … if he had not been held up.
a.would have come
b.came
c.has come
d.will come
22. How would you behave if you … responsible for the matter?
a.are
b.will be
c.would be
d.were
23. It would have been a nice thing if you … our meeting yesterday.
a.attended
b.had attended
c.would attend
d.could attend
24. If I … on holiday now I would go to Spain with my friend.
a.had been
b.have been
c.were
d.am
25. If I … a diary I would forget my appointments.
a.didn’t keep
b.hadn’t kept
c.wouldn’t keep
d.kept
Предмет: Русский язык, автор: Аноним