01/10/2018, 09:25
Nhờ tìm lỗi Bài Tập C/C++
Bài Tâp làm đep họ tên( ví dụ nhập:“TOI la ToI” thì ra “Toi La Toi”)
Và đây là bài của em:
Ideone.com
Ideone is something more than a pastebin; it's an online compiler and debugging tool which allows to compile and run code online in more than 40 programming languages.
Khi chay bi lỗi mọi người giải thích dùm cái ạ, cảm ơn nhiều =D
#include<stdio.h>
#include<string.h>
void inthuong(char *a){
if(*a>='A'&&*a<='Z'){
*a=*a+32;
}
}
void inhoa(char *a){
if(*a>='a'&&*a<='z'){
*a=*a-32;
}
}
int main(){
int n;
do{
scanf("%d",&n);
}while(n>10000);
char A[50];
for(int p=0;p<n;p=p+1){
fflush(stdin);
gets(A);
for(int i=0;i<strlen(A);i=i+1){
inthuong(&A[i]);
}
inhoa(&A[0]);
for(int i=1;i<strlen(A)-1;i=i+1){
if(A[i]==' '){
inhoa(&A[i+1]);
}
}
puts(A);
}
return 0;
}
Bài liên quan
bạn thử dùng cái này xem, mình fix nhẹ cái thôi
Ideone.com
Ideone.com
Ideone is something more than a pastebin; it's an online compiler and debugging tool which allows to compile and run code online in more than 40 programming languages.
tks bạn nhé, nhưng mình nôp bài vẫn không dc bạn ơi, http://oj.hueuni.edu.vn/practice/problem/172/details mình nộp bài ở đây mà ko dc @@@@ chạy trên máy tính thì được, không hiểu sao nữa @@
^^! thế tớ chịu. Hi.
ừm, hi, một mớ bài mình làm trên máy thành công nhưng khi nạp trên trang đấy thì bị lỗi hoài @@ =D
cảm ơn nhé