Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- void draw() {
- //your code is here...
- }
- void isEvenLength() {
- char a;
- int counter = 0;
- printf("type text: ");
- scanf(" %c", &a);
- do {
- scanf("%c", &a);
- if (counter == 0) {
- counter = 1;
- }
- else /*counter ==1*/ {
- counter = 0;
- }
- } while (a != '\n');
- if (counter == 0) {
- printf("Your text's length is even\n");
- }
- else /*counter == 1*/ {
- printf("Your text's length is odd\n");
- }
- }
- void identifyText() {
- //your code is here...
- }
- void hexToDec() {
- char num;
- int i = 0;
- int exponent = 1;
- int sumDec = 0;
- printf("type a diversed number is base 16");
- scanf(" %c", &num);
- while (i != '\n') {
- if (num >= 48 && num <= 57) {
- num = num - 48;
- }
- else if (num >= 65 && num <= 70) {
- num = num - 54;
- }
- else if (num >= 97 && num <= 102) {
- num = num - 86;
- }
- else {
- printf("Error!");
- }
- num = num * exponent;
- exponent = exponent * 16;
- exponent++;
- sumDec = sumDec + num;
- printf("the number in base 10 is: ", sumDec);
- }
- }
- void baseToDec() {
- //your code is here...
- }
- void bitCount() {
- //your code is here...
- }
- void main() {
- int choice;
- do {
- printf("Choose an option:\n1: Draw\n2: Even or Odd\n3: Text type\
- \n4: Hex to Dec\n5: Base to Dec\n6: Count bits\n0: Exit\n");
- scanf("%d", &choice);
- switch (choice) {
- case 1: draw();
- break;
- case 2: isEvenLength();
- break;
- case 3: identifyText();
- break;
- case 4: hexToDec();
- break;
- case 5: baseToDec();
- break;
- case 6: bitCount();
- case 0: break;
- default: printf("Wrong option!\n");
- }
- } while (choice != 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement