C++ Programming Blog

 
 
 
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <process.h>

int main()
{
    int flag = 0;
    char ch = NULL;
    char state = \'0\';
    char token[20] = {NULL};
    char stt[5][3] = {NULL, \'4\', \'5\',
            \'0\', \'1\', \'2\',
            \'1\', \'1\', \'2\',
            \'2\', \'3\', NULL,
            \'3\', \'3\', NULL};

    cout<<\"Input float data : \";
    cin>>token;

    for(int i=0; token[i] != NULL; i++)
    {
        if(isdigit(token[i]))
        {
            ch = \'4\';
        }
        else if (token[i] == \'.\')
        {
            ch = \'5\';
        }
        else
        {
            flag=1;
            printf(\"Invalide value\");
            break;
        }

        for(int j=1; j<3 && ch != stt[0][j]; j++);
        for(int k=1; k<5 && state != stt[k][0]; k++);
        state =stt[k][j];
        if(state==NULL)
        {
            flag=1;
            printf(\"Invalide value\");
            break;
        }
    }
    if(flag==0)
    {
        printf(\"Valide value\");
    }
    getch();
    return 0;
}

    Related Post:
  1. Program to convert an Infix Expression into a Postfix Expression

  2. Program to implement the Prims Algorithm to solve Minimum Spanning Tree Problem (MST)

  3. Program to read a Non-Linear equation in one variable, then evaluate it using Bisection Method and display its kD accurate root

  4. Program to computes the n_th term of the fibonacci series using Toplogical Odering and Dynamic Programming Technique

  5. Program to illustrate the implementation of Scaling Transformation

  6. Program that provides an example of inheritance using private data

  7. Program to copy n number of characters from one string to another at position p

  8. Program to show the use of Bitwise operator OR ( | )

  9. Program of LL parser1

  10. Program to estimate the value of Fourth Derivative of the function at the given points from the given data using Central Difference Formula of order 4

  11. Program to show the 3D Reflection Transformation along xy-plane

  12. Program that defines template of vector class that provides modify and multiplication facility

  13. Program to implement the Kurskals Algorithm to solve Minimum Cost Spanning Tree Problem (MST) using Graphics with Mouse Support

  14. Program to add two polynomial functions

  15. Program that reads marks obtained by a student in a test of 100 marks and print pass if marks are greater than or equal to 50

  16. Program that reads marks obtained by a student in a test of 100 marks and computes his grade

  17. Program to create a queue using static memory allocation

  18. Program that prints odd numbers form 0 to 50 (Using for Loop)

  19. Program for converting string to class object

  20. CREATING A CLASS ACCOUNTS FROM WHICH ARE DERIVED TWO CLASSES CURRENT AND SAVINGS AND THEN ASK THE USER FOR THE TYPE OF ACCOUNT HE WANTS TO CREATE