Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
MVKulik
Digit-system
Commits
157cecc3
Unverified
Commit
157cecc3
authored
Mar 06, 2021
by
S-K-A-R-I-F
Committed by
GitHub
Mar 06, 2021
Browse files
Add files via upload
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
PZ2.1.cpp
0 → 100644
View file @
157cecc3
#include
<iostream>
#include
<iostream>
using
namespace
std
;
char
digit
(
int
num
)
{
switch
(
num
)
{
case
0
:
return
'0'
;
case
1
:
return
'1'
;
case
2
:
return
'2'
;
case
3
:
return
'3'
;
case
4
:
return
'4'
;
case
5
:
return
'5'
;
case
6
:
return
'6'
;
case
7
:
return
'7'
;
case
8
:
return
'8'
;
case
9
:
return
'9'
;
case
10
:
return
'A'
;
case
11
:
return
'B'
;
case
12
:
return
'C'
;
case
13
:
return
'D'
;
case
14
:
return
'E'
;
case
15
:
return
'F'
;
}
}
int
dectox_int
(
int
a
,
int
p
,
char
*
s
)
{
int
num
=
(
int
)
a
;
int
rest
=
num
%
p
;
num
/=
p
;
if
(
num
==
0
)
{
s
[
0
]
=
digit
(
rest
);
return
1
;
}
int
k
=
dectox_int
(
num
,
p
,
s
);
s
[
k
++
]
=
digit
(
rest
);
return
k
;
}
int
main
()
{
double
a
;
char
s
[
80
]
=
{
0
};
int
p
;
system
(
"chcp 1251"
);
system
(
"cls"
);
cout
<<
"Enter digit: "
;
cin
>>
a
;
cout
<<
"Enter a digit system: "
;
cin
>>
p
;
int
k
=
dectox_int
((
int
)
a
,
p
,
s
);
cout
<<
s
;
cin
.
get
();
cin
.
get
();
return
0
;
}
PZ2.1.exe
0 → 100644
View file @
157cecc3
File added
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment