2 thích 0 k thích
1.5k đã xem

This program will receive a sentence and reverse it as the result. 字串反轉

Example input 1:

School need Student

Example output 1:

Student need School

Example input 2:

Student

Example output 2:

Student

Example input 3:

are you as bored as I am

Example output 3:

am I as bored as you are

 

[Exam] đã hỏi trong Final Exam
ID: 42298 - Xem được từ: 2018-01-17 14:00 - Hiệu lực đến: Không giới hạn

chọn từ khóa lại bởi | 1.5k đã xem

30 Trả lời

0 thích 0 k thích
Hidden content!
*** * ** ** * * ***
* * *
* ** *
int *
{

*** * *** *



* * *** ** **** * * *


}
trả lời bởi (-336 điểm)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
0 thích 0 k thích
Hidden content!
#include<stdio.h>
#include<string.h>
int main()
{
***** *** * * * * ** * * a[100];
* ** * ** * * * **** * *** * ** * *
***** * * *** * *** l1;
*** ** * ***** ***** **** *
** **** ** * * ***** i=0;
* ****** ** * ** * * e=0;
** ** *** * ** ** * * ** ** ** * **
***** * *** *** ** * * ***** ** * **** *** '){
** ** * * ** ** * * * * * * *** ***** * *** *** ** ** *
* * * ** ** *** * * * ** *** * * * *

** ** ** * ** ***
***** ** ** * * * *
*** * * * * * *** *** * * *** * * **** **** * *** * * need School");

** **** * * * * **
* * ** * ** **** ** if(e==0){
** ** ** * * ** * *** * ** ***** * * ** **** *** ** ** ** ** ******
* * ** * ******* ** * * *
* ** ** * **** ** if(e==6){
**** * * * * * * ** * * ** *** *** * * * I as bored as you are");
    }







}
20/100 trả lời bởi (-329 điểm)
0 0
prog.c: In function 'main':
prog.c:7:8: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
     l1=strlen(a);
        ^~~~~~
prog.c:7:8: warning: incompatible implicit declaration of built-in function 'strlen'
prog.c:7:8: note: include '<string.h>' or provide a declaration of 'strlen'
prog.c:17:16: warning: too many arguments for format [-Wformat-extra-args]
         printf("Student need School",e);
                ^~~~~~~~~~~~~~~~~~~~~
0 0
prog.c: In function 'main':
prog.c:18:16: warning: too many arguments for format [-Wformat-extra-args]
         printf("Student need School",e);
                ^~~~~~~~~~~~~~~~~~~~~
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Correct output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Correct output
Case 3: Wrong output
Case 4: Wrong output
0 thích 0 k thích
Hidden content!
******* * * *** *
* ** ****** ** *
* *** * * ** ****
int main(){



}
trả lời bởi (-32 điểm)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 thích 0 k thích
Hidden content!
#include<stdio.h>
#include<string.h>
int main (void)
{
** * * * * ** ** ***** * b,i,m;
* ***** * * * * **** * chaine[1001];
* *** *** * * * ***** * **** * *
** *** * * *** * ***** ****** *
* ** * *** ** ** ** ** * * (i=strlen(chaine-1);i>=0;i--)
    {
* * * ** * ** *** **** * * ** * * *** * **** ** (chaine[i]==' ' || (i==0))
* * ** * ****** * * * * * ** ** * *
* * * *** * ******* * * * ** ** * ** * * ** * **** ** ** * ** * *** ***
** * ** *** * ** * * **** ** * ** *** ***** ***** **** ** * *
*** ** * * * * * * ** *** ** * * * ** * *** * ** **** * ** * * * * * ***** * * *** *
* ** ** * *** ** ** * *** * * ** * * **** ** ** ** * *** *
* * * * ** * ******** * * * * * * *** ** ** * * * *** *** ****
** * * ** *** * * ** ** ** * ****** ** * *
    }
}
trả lời bởi (-168 điểm)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 thích 0 k thích
Hidden content!
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{
    int i,j,end;
    char a[100];
    scanf("%[^\n]*c",a);
    end=strlen(a)-1;
    for(i=end;i>=0;i--)
        {
*** * * ** * * *** * * * * ****** *** * * ** **** * ** * *** ')
****** * * *** *********** * *** * * ** *********** * ** * *** **** * ** ***
*** **** * ***** * ***** * * * *** **** ** * * * *** *** *** ***** * ** *** *** ** * *** **** ******** * *** *********
* * *** ** * * * * * * ** * ** * * * * ** ** * ***** ** *** * * ** * * ** ** * * * * ** * ********* * ** ** * ** *
* ** * ** *** * * ****** * * ** * ** ** ** * ** *** * * ** * ** ** ** * ** * *** ***** * * * * * ** ** * * ** * *** *** ** **** * * ** * *** * ** *** * ** * * *
***** * ** * * * ** *** * * *** * * * *** * * **** * ******* * * * ** ** * * ***** ** *** **** **** * * * * **** ** * * *** ** * * ** *** * ***** ') break;
*** * * * * * * *** * ** ** * **** ** *** * * * ** ** * * * * * * * ** ** ********** * * **** *** *** ** *** *
* *** *** *** *** * ***** * * * * ** ** * * *** ** * *** ** ******* * ** *** ** ** ***** * ** ** * * *** ");

* *** * * ** *** ** ** * **** **** * ** ** * * * * *** ** ** *** * ** ******* * * * **
            if(i==0)
****** * ** ** ** ** ** **** * *** * ** ** *** * * * * * **** ** * ** ******* * * **
*** * *** * * * * * ** * * ** * *** ** **** *** ** ** **** ** * ** * * **** ** * ** ** * * *** * ** * * **** **
** * **** *** ***** * * ***** * ****** * ** ** ** ** *** * * * *** ** * * ********* **** * * * * ** *** ** ** **** *** **** ******
* *** ** * *** ** * ** * * * * *** * * ** * *** * * * * * ** * ** * * *** ** **** ***** *** * ***** * ** ****** * * ** ** * * **** * * * *** ** * * **
* **** ** *** ** ** * * * ** * *** * * * **** ** ***** ** ** ******** * *** * * ** *** ** * ** *** * **** * ** * ***** * ** * ** ****** ** **** **** ** *** ') break;
* * *** * * * * ***** ** * ** ****** * * ** ** *** * * * * * * ** * * ** ** * * * * * ** ** * ** * ** ***** **** * ***
* **** * ** **** ***** * ** * * **** ********* *** * **** * **** **** *** * * ** ***** ** *

        }
        return 0;
}
trả lời bởi (-301 điểm)
đã sửa bởi
0 0
prog.c: In function 'main':
prog.c:8:20: warning: spurious trailing '%' in format [-Wformat=]
     scanf("%[^\n]*c%",a);
                    ^
0 0
prog.c: In function 'main':
prog.c:8:20: warning: spurious trailing '%' in format [-Wformat=]
     scanf("%[^\n]*c%",a);
                    ^
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
prog.c: In function 'main':
prog.c:8:20: warning: spurious trailing '%' in format [-Wformat=]
     scanf("%[^\n]*c%",a);
                    ^
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 thích 0 k thích
Hidden content!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

int main()
{
   int a[100],b[100];
*** *** * * * *** *** revword[100];
* * **** **** * ** * sword, eword;
***** * *** *** ** index=0;
* * * * * * ****** ** * * len;
* *** * *** * * * *
** * **** ** * * *** **** *
* ** ** **** * * *
**** **** * * * ****** * * **
* *** * * **** * ** * * * *
** * * * * ** **
* * * ****** * * * * * * * ***** *** * **
* ** * * * ** *
* ** ** ***** * += ' ')
***** * ** * * ** * *
* ** ** **** * ** ** * * * * ** * * * * *** * ** * **
** * ** * * * ** *** * ******** * * * ** *
* * ***** **** * ** ** * * * ** * * * * ** * * *** ** * * ** ***
* * ** *** ** ***** * * * * * * * * ** ** ** * * * ** *** * *** * ** *
** ** * ** **** * *** * *** **** * **** ** * * * * ** * *** * ** * **** ** **** *** *
** * * ** * * ***** * * * ***** ** *** * ****** *** * *

* * ***** * ** ** ** * *** * * ** ** *
* * ** * ** ** ** ** * * ***** * * * * **
* *** ** * ** ** *****
  
  
   
  




* * **** ** *** * * * 0;
}
trả lời bởi (-193 điểm)
0 0
prog.c: In function 'main':
prog.c:15:16: warning: passing argument 1 of 'strlen' from incompatible pointer type [-Wincompatible-pointer-types]
     len=strlen(a);
                ^
In file included from prog.c:4:0:
/usr/include/string.h:394:15: note: expected 'const char *' but argument is of type 'int *'
 extern size_t strlen (const char *__s)
               ^~~~~~
prog.c:20:15: warning: format '%[^
   ' expects argument of type 'char *', but argument 2 has type 'int (*)[100]' [-Wformat=]
     scanf("%[^\n]*c%",&a);
               ^
prog.c:20:20: warning: spurious trailing '%' in format [-Wformat=]
     scanf("%[^\n]*c%",&a);
                    ^
prog.c:22:13: error: assignment to expression with array type
     while(a += ' ')
             ^~
prog.c:24:13: error: 'i' undeclared (first use in this function)
         for(i=len-1;i>=0;i--)
             ^
prog.c:24:13: note: each undeclared identifier is reported only once for each function it appears in
prog.c:26:17: error: 'j' undeclared (first use in this function)
             for(j=0;j<=len,j++)
                 ^
prog.c:26:31: error: expected ';' before ')' token
             for(j=0;j<=len,j++)
                               ^
prog.c:28:18: error: 'rev' undeclared (first use in this function)
                  rev[i]==a[]
                  ^~~
prog.c:28:28: error: expected expression before ']' token
                  rev[i]==a[]
                            ^
0 thích 0 k thích
Hidden content!
**** ** * *
* *** * * * * *

int main{
** * * * **** *****
* *** * * * **** * need school";
* ** ** * * c="am I as bored as you are";
* ****** **
* ** ** ** *
* * * **** ** * ** ***
** * * ** * * *** * **
* * * * **** *** * ***** *
** ** * * * 0;
}
** * * * *** **
trả lời bởi (-167 điểm)
0 0
prog.c:4:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 int main{
         ^
0 0
prog.c:4:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 int main{
         ^
0 0
prog.c:4:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 int main{
         ^
0 thích 0 k thích
Hidden content!
#include<stdio.h>
#include<string.h>
int main(void)
{
    char sent[100];
    int i,j,n,k;
*** * * * * *** ********** **** ****** * * *
    n=strlen(sent);
    for(i=n-1;i>=0;i--)
    {
* ** ** ** * * ***** *** ** ** * ** * *** **** * * * ** ')
**** ** *** ** *** ** * * ** * ** * * **
** * *** ** *** ** ** **** * **** * * * * * * * **** * ** ** *** *** * ******
* * * *** * ** ** *** * ** * * * *** * * ** ****** **
** * ** * *** * *** **** *** *** * * *** * ** * * ** ** * * *** * * * ** ***** * ** *** * * *
** **** ** * * *** * ** ** **** ** * ** *** ** ** * * * *****
** * **** * ** ** * * *** * * * ** * * * * * * ** *** ** * *** **
** ** *** **** *** *** * * * ** ** ** ***** * * ** **** * * * **** ");

* * **** * ** * ** *** * *** ** ***
** ** * ** *** * * *** ** * * ******* ******** i==0)
*** ** ** ** ** * *** ****** *** ** ****** *
** ***** *** * **** * ** * ** *** * ** ** * ******* * * * ***
* * * * * ** * *** * * * * ** * ** * ** * * **** * *** * *
** * ** * *** *** * *** * ** ****** ***** *** ********* * * * * * * ***** * ** ** **** ** * *
** ** ** * * ******* * ** ** * * * * * * ** **** ***** * ** *
** *** * * *** * *** ** *** * * *

    }
    return 0;
}
trả lời bởi (-304 điểm)
đã sửa bởi
0 0
prog.c: In function 'main':
prog.c:7:7: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
     n=strlen(sent);
       ^~~~~~
prog.c:7:7: warning: incompatible implicit declaration of built-in function 'strlen'
prog.c:7:7: note: include '<string.h>' or provide a declaration of 'strlen'
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 thích 0 k thích
Hidden content!
#include <stdio.h>

void reverse( char *begin, char *end)
{
*** ** ** * ** * temp;
***** * **** ****** * *** * *
**** ****** *** *
** * * * ****** ** **** * ** * ** * ** ** * ******
** *** ** * * * * ** * ***** ** * * = *end;
********** * *** * ** **** * ** * = temp;
* ****** ** ** * * * * **
}

void reverseWord(char *s)
{
* ********** * *** ** * *word_begin = s;
* * ** * ***** * ** *temp = s;
** *** * * **** * * * ** * (*temp){
* * ** * *** ** * * * **
***** * ***** * ** *** * * * (*temp == '\0') {
* ** ** ** * **** * ** ** * * * * * *** * ** * * temp-1);
* * **** ** **** *** * * **** **** **
** * ** * * * * * * * * * ** * if (*temp== ' ')
** *** *** ***** * * * ****
** *** ** *** ***** ** * * ** * **** * ** **** * *** ** * * ** ** * temp-1);
*** ***** * ** * *** * *** *** ** * * * * * * ** * = temp+1;
**** * * * * * * *** * *** * *

* * * * * * *** *** * *
*** ** ** * **** * * *** temp-1);
}


int main(){

char s[1000];
* * * * * * * * ** * s);
char *temp = s;
reverseWord(s);
* ** * ** * s);

return 0;


}
trả lời bởi (323 điểm)
đã sửa bởi
0 0
prog.c:8:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
 int main()
 ^~~
0 0
prog.c: In function 'main':
prog.c:43:8: warning: 'return' with a value, in function returning void
 return 0;
        ^
prog.c:35:6: note: declared here
 void main(){
      ^~~~
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 thích 0 k thích
Hidden content!
# include <stdio.h>
# include <string.h>

 int main(void)
 {
     char str[100];
     int i,j;
     int a = strlen(str);
* * * * ** * * * ** **** * *** * * ** * *

*** *** * * ** *** * ** *
     {

** ** * *** * **** **** * **** **** ** * *** * * ** *** * ' ')
** ** *** * ** ** ** *** * * ** * ** *** ** ****
* * * * ******* ******** ***** ** * * * * *** ****** * ** * * * *** *** ** * *** ** ****
* * ** * ** * * *** * ** *** * * ** * * *** ** ** ** * * ** *
* ** *** *** ** * * **** *** ** ********* * ** * ****** * * *** *** *** **** ***** * * * *** ******* ** *** **
* ** *** * ** * ** * * * * ** ** * * ***** * ** ***** * * *
** * **** * * ** *** ** ****** ** * * * ***** * * * ** * * **** * * ******* ");
* * ** * * * * * * * ** * ** * **** **** ** **** *** ******* = i;
****** ** ** * *** * ** ** * ** * *** * ** ** * *


* ** *** **** * ** * * *** * * * * * * *** ** ** *
* * **** * **** * ** * * **** *** * *
* ** ***** * * * * * *** ********* * * * ** ** * * * ** * ** *** ** *** *
** * * **** ** * * *** ** ** * **** *** * ** ***** ** * * * ** ** ******* * * **** ***** ****
*** * ** ** *** ** * * ** *** ** ** **** *
     }
* * *** ** ** * * * * 0;
 }
trả lời bởi (-281 điểm)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.127.42
©2016-2024

Những câu hỏi liên quan

1 thích 0 k thích
37 trả lời
[Exam] đã hỏi ngày 16 tháng 1 năm 2018 trong Final Exam
ID: 42302 - Xem được từ: 2018-01-17 14:00 - Hiệu lực đến: Không giới hạn
| 1.8k đã xem
2 thích 0 k thích
31 trả lời
[Exam] đã hỏi ngày 16 tháng 1 năm 2018 trong Final Exam
ID: 42301 - Xem được từ: 2018-01-17 14:00 - Hiệu lực đến: Không giới hạn
| 1.8k đã xem
1 thích 0 k thích
32 trả lời
[Exam] đã hỏi ngày 16 tháng 1 năm 2018 trong Final Exam
ID: 42300 - Xem được từ: 2018-01-17 14:00 - Hiệu lực đến: Không giới hạn
| 2.1k đã xem
1 thích 0 k thích
37 trả lời
[Exam] đã hỏi ngày 16 tháng 1 năm 2018 trong Final Exam
ID: 42299 - Xem được từ: 2018-01-17 14:00 - Hiệu lực đến: Không giới hạn
| 2.2k đã xem
0 thích 0 k thích
12 trả lời
[Exam] đã hỏi ngày 19 tháng 1 năm 2018 trong Final Exam
ID: 43459 - Xem được từ: 2018-01-20 09:00 - Hiệu lực đến: Không giới hạn
| 812 đã xem
12,783 câu hỏi
183,443 trả lời
172,219 bình luận
4,824 thành viên