Difference between revisions of "C : Koodinäited"

From mmmv_kos
Jump to: navigation, search
(Created page with " * C * C++ = Konsooliväljund = <syntaxhighlight lang="c"> //#include <wchar.h> #include <stdio.h> #include <uchar.h> int main(void) { char32_t ch[]=U"TEre...")
 
m (Konsooliväljund)
 
Line 52: Line 52:
  
 
-----verbatim--end--------------
 
-----verbatim--end--------------
 
 
 
*/
 
*/
  
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 19:15, 16 January 2020


Konsooliväljund

//#include <wchar.h>
#include <stdio.h>
#include <uchar.h>

int main(void) {
    char32_t ch[]=U"TEreжжжжжaäöü";

    puts("TEreжжжжжaäöü");
    char cc[]=u8"TEreжжжжжaäöü Ω";
    puts(cc); // adds the newline

    char cpi[]=u8"The Pi \"π\"";
    printf("%s",cpi); // without the ending newline
    printf("%s","=");
    printf("%f",3.141592653589793);
    printf("%s","     ");
    printf("%d",42);
    return 0;
}

/* The console output:
-----verbatim--start--------------
TEreжжжжжaäöü
TEreжжжжжaäöü Ω
The Pi "π"=3.141593     42
-----verbatim--end--------------



The Makefile
-----verbatim--start--------------

all: compile run


compile:
	gcc -std=c11 ./mm.c

run:
	./a.out

-----verbatim--end--------------
*/