Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///Transf int -> sir char
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main() {
- char a[256] ;
- int nr,x,p=1,k=1,c;
- cin>>nr;
- x=nr;
- while(nr>9){
- nr=nr/10;//elimin ultima cifra din numar
- p=p*10;
- k++;//creste numarul de cifre
- }
- for(int i=0;i<k;i++){
- c=x/p%10;
- p=p/10;
- a[i]=c+'0';
- }
- cout<<a;
- // cin.getline(a,256);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement