The second day of C in iOS

Source: Internet
Author: User

////main.m//lessoncondition////Created by Laouhn on 15/7/15.//Copyright (c) 2015 David. All rights reserved.//#import<Foundation/Foundation.h>intMainintargcConst Char*argv[]) {    /*BOOL Data type: Only true and false two kinds of state logic and the expression in front of a > B result is false, logic and the following expression a > 4, the result is false, according to the criterion of logic and expression (with true), to determine the entire logic and expression result is false, so the bool variable The results stored in the Isture are false. Note: short-circuit phenomena, logic and logic, or short-circuit phenomena in the presence of logic and short-circuit phenomenon: Once the logical and && symbol left expression result is false, the logic and the right side of the expression is no longer executed, because at this time, the entire logic and              The result of the expression is false, regardless of whether the right side indicates that the result is true or false, and does not affect the entire logic and expression results. Logical or short-circuit phenomenon: Once the discovery logic or | |              The expression on the left side of the symbol is true and no longer judges the logical or right expression, because the entire expression result is already true and does not affect the result of the entire expression. *///int a=3;//int b=5;//BOOL Isture=yes;//isture = A>b && a > 4; //int a = 3;//BOOL isture = YES;//isture = (A > 5) && (a = +);//printf ("isture =%d, a =%d\n", Isture, a);//    //int a =;//if (a>85) {//printf ("I invite everyone to Dinner");////    }//char a = ' 0 ';//printf ("Please enter a character");//scanf ("%c", &a);//if (a = = ' m ') {//printf ("male");//    }//Else//printf ("female");//int year = 0;//printf ("Please enter a year");//scanf ("%d", &year);//if (year% 400 = = 0 | | (Year% of 4 ==0 && year% 100! = 0)) {//printf ("is a leap year");//    }//Else//printf ("is common year");//int a = ten;//int b =;//int min = 0;//min = a > b? b:a;//printf ("Minimum value%d", min); //a>b?printf ("Maximum value is%d", a):p rintf ("Maximum is%d", b); //Step 1; When you encounter if is, the conditional expression after if, copy it intact, and then rewrite the IF? //Step 2: Encounter else, rewrite the else to://Step 3: Return the corresponding value as needed. The principle of return: when the previous conditional expression is set, returns: The preceding value, when the previous expression is not valid, returns the following value. //int num1 = 3;//int num2 = 4;//int max = 0;//if (Num1 > num2) {//max = NUM1;//    }//Else//max = num2;//printf ("Max is%d", max);//int a = 0;//printf ("Please enter a value between 1-4");//scanf ("%d", &a);//if (a = = 1) {//printf ("Spring Spring");//} else if (a = = 2) {//printf ("Summer Summer");//}else if (a = = 3)//    {//printf ("Autumn Autumn");//    }//Else//printf ("Winter Winter");//char a = ' 0 ';//printf ("Please enter a character:");//scanf ("%c", &a);//if (a>= ' 0 ' &&a<= ' 9 ') {//printf ("This is Digital");//    }//else if (a>= ' a ' &&a <= ' z ')//printf ("This is the letter");//else if (a >= ' a ' && a <= ' Z ')//printf (" This was capital letter");//if (<= a &&a <=) {//printf ("This is Digital");//    }//else if (a>=65&&a<=90)//printf (" This was capital letter");//else if (a>=97&&a<=122)//printf ("This is the letter");//int number = 0;//printf ("Please enter an extension number: 801, marketing department; 802, career planning department; 803, Finance department; 804, teaching Department; 805, general manager's Office");//scanf ("%d", &number);//switch (number) {//Case 801://printf ("marketing Department");//Break ;//            //Case 802://printf ("Career Planning Department");//Break ;//            //Case 803://printf ("Finance Department");//Break ;//            //Case 804://printf ("Teaching department");//Break ;//            //            //Case 805://printf ("General manager's Office");//Break ;//            //Default://Break ;//    }    /*int a = 0;    printf ("Enter a number between 1-4:");    scanf ("%d", &a); The expression for switch must be an expression after the//case expression, which must be an integer constant expression//Note: When defining a variable in the case branch, enclose the case branch with {}//break jump out of the branch if the current branch has no break            , you will continue to want to execute the contents of the other branches until you meet the break to end switch (a) {case 1:printf ("Spring");        Break            Case 2:printf ("Summer");        Break            Case 3:printf ("Autumn");        Break            Case 4:printf ("Winter");        Break            default://when there is no match to the corresponding branch, the execution of the Default,default position does not affect the execution of the default printf ("No foot reflexology roll duzi!");    Break If statement, the switch statement is clearer than the IF statement more clearly if statements are more broadly applicable than switch statements*/        return 0;}

The second day of C in iOS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.