.
Ученик
(0)
9 лет назад
#include <iostream>using namespace std; const int N =300;int main(){int n, m;//2 ciclefor(int i=100; i<=N; i++){n= i % 10;for(int j=100; j<=N; j++)m = n%10;cout<<m<<" ";}// 1 ciclecout<<endl;for(int i=100; i<=N; i++)cout<<i%10<<" ";cin.get();}
Ученик
(112)
9 лет назад
#include <iostream>
using namespace std;
const int N =300;
int main()
{
int n, m;
//2 cicle
for(int i=100; i<=N; i++)
{
n= i % 10;
for(int j=100; j<=N; j++)
m = n%10;
cout<<m<<" ";
}
// 1 cicle
cout<<endl;
for(int i=100; i<=N; i++)
cout<<i%10<<" ";
cin.get();
}
Ученик (112)
9 лет назад
вместо 300 можно поставить любое число
Николай Веселуха
Высший разум
(362149)
9 лет назад
#include <iostream>
#include <string>
using namespace std;
int main() {
unsigned n, tmp, digit, signs;
const unsigned zero = 0, one = 1, two = 2, three = 3, ten = 10, hundred = 100;
do {
cout << "n: ";
cin >> n;
} while (n < hundred);
// 1. Two loops
tmp = n;
signs = zero;
while (tmp) {
tmp /= ten;
++signs;
}
tmp = n;
for (unsigned i = three; i < signs; ++i) tmp /= ten;
digit = tmp % ten;
cout << "1: " << digit << endl;
// 2. One loops
tmp = n;
signs = int(log10(tmp)) + one;
for (unsigned i = three; i < signs; ++i) tmp /= ten;
digit = tmp % ten;
cout << "2: " << digit << endl;
// 3. Bonus!
string t = to_string(n);
cout << "3: " << t.at(two) << endl;
cin.sync();
cin.get();
}
xtbvc17
Профи
(632)
9 лет назад
using UnityEngine;
using System.Collections;
public class Controls : MonoBehaviour
{
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = Vector3 (moveHorizontal, 0.0f, moveVertical);
Rigidbody.AddForce (movement);
}
}
support_ routera wifi
Ученик
(104)
9 лет назад
Здравтсвуйте вот так:
//css++
uyuy=6789
//htmlyil//php
c++=c++:yt=ytru//$
css>>>/
++++css
//## retreck//##55
}
?php<
c++
{}
^^^^^___^^^^^^
*_* stulyur c++\\game
//html game//c++\/\/
/\/\
s++++
css++
dsfor
diyavol
//kjjdld//ede
#?php inklus<
{
dffg>dgf
p++//html\\
css="c++="<?skript>css java/skript#<?php>" cssdf c++"
}
css++\\c++\\
советуем не отвечать на сообщение оно отправилось ботом а если решите ответить пишите в источнике: Re: rrt6676754334234//otvet//ответ
--------------------------------------------------------
С Уважением поддержка по среде програмирования
Прорамист Поддержка: Эмиль
------------------------------------------------------------
Источник: Re: rrt54544555543
Amir King
Знаток
(256)
9 лет назад
#include <iostream>#include <string>using namespace std;int main() {unsigned n, tmp, digit, signs;const unsigned zero = 0, one = 1, two = 2, three = 3, ten = 10, hundred = 100;do {cout << "n: ";cin >> n;} while (n < hundred);// 1. Two loopstmp = n;signs = zero;while (tmp) {tmp /= ten;++signs;}tmp = n;for (unsigned i = three; i < signs; ++i) tmp /= ten;digit = tmp % ten;cout << "1: " << digit << endl;// 2. One loopstmp = n;signs = int(log10(tmp)) + one;for (unsigned i = three; i < signs; ++i) tmp /= ten;digit = tmp % ten;cout << "2: " << digit << endl;// 3. Bonus!string t = to_string(n);cout << "3: " << t.at(two) << endl;cin.sync();cin.get();}
Дано натуральное число n (n>99). Определить его третью (с начала) цифру. Задачу решить двумя способами:
а) с использованием двух операторов цикла;
б) с использованием одного оператора цикла.