Write a program that prints its input one word per line.

Write a program that prints its input one word per line.

#include <stdio.h>

#define IN  1   /* inside a word */
#define OUT 0   /* outside a word */

int main()
{
    int c, state;

    state = OUT;

     while ((c = getchar()) != EOF) {
         if (c == ' ' || c == '\t' || c == '\n') {
             state = OUT;
         } else if (state == OUT) {
             printf("\n");
             putchar(c);
             state = IN;
         } else {
             putchar(c);
         }
     }
         return 0;
}

How Exactly Do I Deal With Japanese Characters in C ?

How Exactly Do I Deal With Japanese Characters in C  ?

#include <iostream>
#include <string>
using namespace std;

int main()
{
    wstring nihongo = L"みんなのにほんご";
    wcout << nihongo << endl;
    return 0;
}

C:UsersLeonneLeomediaMetaDatterTest.cpp|7|error: stray '201' in program|

C:UsersLeonneLeomediaMetaDatterTest.cpp|7|error: stray '@' in program|

C:UsersLeonneLeomediaMetaDatterTest.cpp||In function 'int main()':|

C:UsersLeonneLeomediaMetaDatterTest.cpp|7|error: converting to execution character set: Illegal byte sequence|

||=== Build finished: 3 errors, 0 warnings ===|

Using Bash to input stuff into c program

Using Bash to input stuff into c program

Hello world:
1) Item 1
2) Item 2
Enter : 2

Item 2 Menu
1) sub Item A
2) sub item B
enter: 1

pmenu () {
    printf '%s) %sn' "$1" "$2"
}

m1 () {
    pmenu 1 'Item 1'
    pmenu 2 'Item 2'
}
m2 () {
    pmenu 1 'sub Item A'
    pmenu 2 'sub Item B'
}

printf 'Hello, World:n'

m1
read -p "enter: " m

case "$m" in
    1 ) m2 ;;
    2 ) m2 ;;
esac

read -p "enter: " m

echo "You chose: $m"

printf '2n1n' | program