Ayúdanos a dar forma a GoConqr. ¿Qué deberíamos añadir?

Fichas

Sin título

Magda Sroka C Inglés 27 fichas

print a large integer large flat point a single character a string a hexdecimal no (each in diff line with comments after)

Fichas del conjunto (27)

  1. 1hello world#include
    main()
    {
    print.f("hello, world\n") ;
    }
  2. 2{} what is in between them?statements of function
  3. 3function that reads inputscanf
  4. 4write a program to convert fahr to celcius from 0,20...300F (use integers only use while statement, what divssadv?)#include
    main()
    {
    int fahr,celc;
    int lower, upper, step;
    lower = 0;
    upper= 300;
    step =20;
    fahr=lower;
    while(fahr=
  5. 5statement for 2 columns separated by tab (whats add/dissadv?) 2 columnts right justifiedA "%d\t%d\n"
    B "%3d %6d\n"
  6. 6A print as a decimal integer at least 6 decimal wide B print as a decimal integer C print as a floating point D print as a floating point, at least 6 integers wide E print as a floating point, 2 characters after decimal point f print as a floating point, at least 6 wide and 2 after decimal pointA %6d
    B %d
    C %f
    D %6f
    E %.2f
    F %6.2f
  7. 7write a program to convert fahr to celcius from 0,20...300F use floating point and while statement, cold you wrirte : farh-32?#include
    main()
    {
    float fahr, celc;
    int lower, upper, step;
    fahr=lower;
    while(farh=
  8. 8write a program to convert fahr to celcius from 0,20...300F use floating point and "for" statement#include
    main()
    {
    int= fahr;
    for(fahr=0; farh= <=300; fahr= fahr+200;
    printf("%3d %6.1f\n", farh, (5/9)*(fahr-32));
    }
  9. 9write a program to convert fahr to celcius from 0,20...300F use floating point and "for" statement and symbolic constants, why farh can be int?#include
    #define LOWER=0
    #define UPPER=300
    #define STEP=20
    main()
    {
    int= farh;
    for(farh=LOWER; fahr<=UPPER, fahr= fahr+STEP);
    printf("%3d %6.1f\n", fahr, (5.0/9.0)*(fahr+32));
    }
  10. 10what it would be in C? LOWERsymbolic constant, by convention written in capitals
  11. 11what is a text steam?is a sequence of characters divided into lines, each line consists of 0 or more characters followed by a new line character
  12. 12whtas is A != B == C ¦¦ D &&A non equals to
    B Equal to, C needs to distinguish between it and = which c uses for assignment
    C or
    D and
  13. 13write a program which copies its input to its output , why c is int?#include
    main()
    {
    int c;
    c= getchar();
    while (c != EOF) {
    putchar (c) ;
    c=getchar () ;
    }
    }
    c must be big enough to hold char but also EOF (end of file) which is a integer
  14. 14whats is EOF"end of file" it is an integer which is defined by
  15. 15why main is written followed by ()() indicates that the function expects no arguments
  16. 16whats does it mean: c=getchar()every time getchar is called it reads the next input character from a text steam. That is after c=getchar() the variable c contains the next character of input
  17. 17whats does ++ mean? is there a similar expression?++ increment by 1, equivalent to x=x+1, can be used as prefix or surfix (++x or x++ these two forms have different values in expressions, analogously -- works
  18. 18concise way to write a program what coutns that copies file#include
    main()
    {
    while((c= getchar( )) != EOF)
    putchar (c);
    }
  19. 19character counting (use while)#include
    main()
    {
    long nc;
    nc=0;
    while((getchar()) != EOF)
    ++nc;
    printf("%1d\n", nc);
    }
  20. 20how does while loop operates?the condition in parentheses is tested, if it is true then the body of the loop (enclosed by BRACES is executed)
  21. 21explain how for loop operates on example of : for (fahr = 0; fahr <= 300 ; fahr=fahr+20) print ("%3f %6.1f\n", fahr, calc) ;the initialization fahr=0 is done once before the loop is entered
    farh <= 300 controls the loop, if it is true then the body of the loop (here the print statement (for loop requires to have the body if it is none p. 18 then you put only semicolon, ALWAYS put semicolon!
    then the increment step is executed (fahr+20 and the condition is re-evaluated)
  22. 22character counting (use for and double)#include
    main()
    {
    long cn,
    for(cn=0; cn != EOF; ++cn)
    ;
    printf("%.0f\n", nc);
    }
    C uses f for both float and double), note for needs ot have body , which is here empty so ; is necessary which is a null statement wich satfsies requirement for body.
  23. 23line counting, use while#include
    main()
    {
    int c, nl;
    nl =0;
    while ((c=getchar()) != EOF)
    if (c == '\n')
  24. 24counting characters, lines, and words#include
    #define IN 1
    #define OUT 0
    main()
    {
    int c, nc, nl, nw, state;
    state= OUT;
    ln, nw, nc=0;
    while ((getchar()) != EOF) {
    +nc;
    if (c= = '\n')
    +nl;
    if (c == ' ' ¦¦ c== '\n' ¦¦ c== '\t')
    state= OUT;
    else if (state= OUT) {
    +nw;
    state =IN;
    {
    {
    printf("%d %d %d\n", nc, nl, nw);
    }
  25. 25program that count no. of occurrence of each digit, white space (blanks, tabs, newlines), and all other characters#include
    main()
    {
    int c, i, nwhite, nother;
    int ndigit [10]
    nwhite= nother =0;
    for( i >=0; I<10; ++i)
    ndigit[i]=0;
    while ((c=getchar()) != EOF)
    if (c>='0' && c<= '9')
    ++ ndigit[c-'0'];
    else if (c==' ' ¦¦ c=='\n' ¦¦ c=='\t')
    ++ nwhite;
    else
    ++ nother;
    }
  26. 26print a large integer large flat point a single character a string a hexdecimal no (each in diff line with comments after)print a large integer large flat point a single character a string a hexdecimal no (each in diff line with comments after)
  27. 27rules for variablesdo not start with no(can end)
    no spaces
    no words used in program for sth elese eg "while", "main" etc
    no special characters except underscore

Información

Descripción
C Fichas sobre Sin título, creado por Magda Sroka el 05/11/2016.
Creado por
Magda Sroka
Visitas
1
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué deberíamos añadir?