C言語メモ2
IO1.0
IO2.0
nc1.0
nc2.0
nl1.0
nbntnl1.0
nbntnl2.0
#include <stdio.h>
/* ; 1 */
main()
{
int c;
c = getchar();
while(c != EOF){
putchar(c);
c = getchar();
}
}
IO2.0
#include <stdio.h>
/* ; 2 */
main()
{
int c;
while((c = getchar()) != EOF){
putchar(c);
}
}
nc1.0
#include <stdio.h>
/* ; 1 */
main()
{
long nc;
nc = 0;
while(getchar() != EOF)
++nc;
printf("%ld
", nc);
}
nc2.0
#include <stdio.h>
/* ; 2 */
main()
{
double nc;
for(nc = 0; getchar() != EOF; ++nc)
; /* */
printf("%.0f
", nc);
}
nl1.0
#include <stdio.h>
/* ; 1 */
main()
{
int c, nl;
while((c = getchar()) != EOF)
if(c == '/n')
++nl;
printf("%d
", nl);
}
nbntnl1.0
#include <stdio.h>
/* 、 、 ; 1 */
main()
{
int c, nb, nt, nl;
nb = 0;
nt = 0;
nl = 0;
while((c = getchar()) != EOF){
if(c == ' '){
++nb;
}
if(c == '\t'){
++nt;
}
if(c == '
'){
++nl;
}
}
printf("%d %d %d", nb, nt, nl);
}
nbntnl2.0
#include <stdio.h>
/* 、 、 ; 2 */
main()
{
int c, nb, nt, nl;
nb = 0;
nt = 0;
nl = 0;
while((c = getchar()) != EOF){
if(c == ' '){
++nb;
}
else if(c == '\t'){
++nt;
}
else if(c == '
'){
++nl;
}
}
printf("%d %d %d", nb, nt, nl);
}