By GokiSoft.com|
21:04 30/12/2021|
Lập Trình C
[Video] Bài tập ôn tập String - Lập trình C - C2110L
Bài tập ôn tập String - Lập trình C
/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
#include <string.h>
int main()
{
//Bai 1:
/**char s1[50];
printf("\nNhap s1 = ");
fflush(stdin);fflush(stdout);
gets(s1);
int length1 = strlen(s1);
printf("\nLength: %d", length1);*/
//Bai 2
/**
char s1[50], s2[50];
printf("\nNhap s1 = ");
fflush(stdin);fflush(stdout);
gets(s1);
printf("\nNhap s2 = ");
fflush(stdin);fflush(stdout);
gets(s2);
strcat(s1, s2);
int length = strlen(s1);
printf("\nLength: %d", length);
*/
//Bai 3
char s[50];
printf("\nNhap s = ");
fflush(stdin);fflush(stdout);
gets(s);
int length = strlen(s);
int i;
for(i=0;i<length;i++) {
printf("\n%c", s[i]);
}
return 0;
}
Tags:
Phản hồi từ học viên
5
(Dựa trên đánh giá ngày hôm nay)