All pastes #277929 Raw Edit

Unnamed

public cpp v1 · immutable
·published 2006-12-13 18:18 UTC
rendered paste body
#include <iostream>#include <math.h>#include <conio.h>using namespace std;int main(){  float zahld,zwischenspeicher;  int rest,i;    char zahlh[13];  i=11;  cout << "Bitte eine dezimale Zahl eingeben.\n";  cin >> zahld;  zwischenspeicher=zahld;  zahlh[12]='\0';  while(zwischenspeicher>=1.)    {    rest=fmod(zwischenspeicher,16);    zwischenspeicher=floor(zwischenspeicher/16);    switch (rest)      {      case 10:        zahlh[i]='A';        break;      case 11:        zahlh[i]='B';        break;      case 12:        zahlh[i]='C';        break;      case 13:        zahlh[i]='D';        break;      case 14:        zahlh[i]='E';        break;      case 15:        zahlh[i]='F';        break;      default:      	zahlh[i]=rest;      i--;      cout <<zwischenspeicher << "\t" << rest <<" ";      }    }  cout << "Die Zahl " << zahld << " entspricht im hexadezimalen Sytem der Zahl " << zahlh << ".";  getch();  return 0;}