vendredi 29 janvier 2016

Simpe if and else in C programming

I want to make this program say that if you enter 1 the screen will display "yes G is the 1st note in a G chord", if you enter anything else it will print "wrong!" and then loop back into the beginning, here is my attempt at it. Also, I know there are different ways to do this, but it is for a school assignment and the enum data-type is necessary, though this code is far reaching for just displaying use of enum, it bothers me I can't get this to work. Any pointers? (no pun intended).

    enum Gchord{G=1,B,D,};
    int main()                            
    {   printf( "What interval is G in the G chord triad \nEnter 1 2 or 3\n" );  
int note;
 scanf("%i",&note);    

if (note = 1 ){                 
    printf ("Yes G is %ist note in the G-chord\n",G )};
else(
printf("no, wrong");     
return(0):       
};

Aucun commentaire:

Enregistrer un commentaire