Giter VIP home page Giter VIP logo

Comments (3)

Konstantin8105 avatar Konstantin8105 commented on August 23, 2024 2

I working for this issue at this week

from c2go.

Konstantin8105 avatar Konstantin8105 commented on August 23, 2024

Some example:

#include<stdio.h>
enum week{Mon, Tue, Wed};
int main()
{
    enum week day;
    day = Wed;
    printf("%d",day); // result is : 2
    return 0;
}
#include<stdio.h>
enum year{Jan, Feb, Mar, Apr, May, Jun, Jul, 
          Aug, Sep, Oct, Nov, Dec};
int main()
{
   int i;
   for (i=Jan; i<=Dec; i++)      
      printf("%d ", i);
   return 0;
}
#include <stdio.h>
enum State {Working = 1, Failed = 0, Freezed = 0};
int main()
{
   printf("%d, %d, %d", Working, Failed, Freezed); // result : 1, 0, 0
   return 0;
}
#include <stdio.h>
enum day {sunday, monday, tuesday, wednesday, thursday, friday, saturday};
int main()
{
    enum day d = thursday;
    printf("The day number stored in d is %d", d); //Result : The day number stored in d is 4
    return 0;
}
#include <stdio.h>
enum day {sunday = 1, monday, tuesday = 5,
          wednesday, thursday = 10, friday, saturday}; 
int main(){
       printf("%d %d %d %d %d %d %d", sunday, monday, tuesday,
            wednesday, thursday, friday, saturday); // Result : 1 2 5 6 10 11 12
    return 0;}
#include <stdio.h>
enum State {WORKING = 0, FAILED, FREEZED};
enum State currState = 2;
 enum State FindState() {    return currState;}
 int main() {
   (FindState() == WORKING)? printf("WORKING"): printf("NOT WORKING");
   return 0;
}

Examples from http://www.geeksforgeeks.org/enumeration-enum-c/

from c2go.

Konstantin8105 avatar Konstantin8105 commented on August 23, 2024

Ready for check

from c2go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.