C Language Basic grammar, over the array can re-write some algorithms and data structures

Source: Internet
Author: User

  

1 //input A, B, output a+b2 /*#include <stdio.h>3 int main ()4 {5 int A, b;6 scanf ("%d%d", &a,&b);7 printf ("%d", a+b);8 }*/9 /*Ten //Enter a character to return his ASCLL code One #include <stdio.h> A int main () - { - char A; the scanf ("%c", &a); - printf ("%d", a); - }*/ -  +  -#include <stdio.h> + intMain () A { at     CharA; -     Charb; -      while(scanf ("%c%c", &a,&b)!=eof)//when there is a space in the middle, the input parameters should also have a space, when there is no space, you do not have to enter a space. -     { -printf ("%d\t", a); -printf ("%d", b); in     } - } to  + /*** - * * Usage of Switch the */ * /* $ #include <stdio.h>Panax Notoginseng int main () - { the int A; + while (scanf ("%d", &a)!=eof) A     { the switch (a) +         { - Case (1): {//His grandmother's original to add a colon $ printf ("a=1\n"); $ Break ; -             } - Case (2): { the printf ("a=2\n"); - Break ;Wuyi             } the default:{ - printf ("Not 1 nor 2\n"); Wu Break ; -             } About         } $     } - }*/

  

C Language Basic grammar, over the array can re-write some algorithms and data structures

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.