2 like 0 dislike
8.7k views

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] asked in Final Exam
ID: 42298 - Available when: 2018-01-17 14:00 - Due to: Unlimited

retagged by | 8.7k views

30 Answers

0 like 0 dislike
Hidden content!
********** * ******
* ***
* *
int ***
{

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



* * * **** * * * *


}
answered by (-336 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
0 like 0 dislike
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 answered by (-329 points)
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 like 0 dislike
Hidden content!
** *** *** ****
*** ******* ** * **
* * ** ** *** *
int main(){



}
answered by (-32 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 like 0 dislike
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))
* * * ** ** ** * *** **** * ** * * * * *
* * ** * *** ** ** * * ****** *** ***** ** ** * * **** ********* *** *
** * * ** * * * * * * ** ** * ** *** * ***** * * ** * * **
** * ** * **** * * * * **** * * * * * * * * ** ******* ** * * * ** * * * * ** ** ** ** * ** **** *** * ** ** *
* ** * * * * * **** ***** **** * ** * ****** * ** * * * * ****
* ** * * ** * *** *** * * ** ** ** * ** *** * * * ** ** *** *** **** ****
*** **** * * * ** * * * * * * ** * *
    }
}
answered by (-168 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 like 0 dislike
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;
}
answered by (-301 points)
edited by
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 like 0 dislike
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;
}
answered by (-193 points)
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 like 0 dislike
Hidden content!
* ** **** *
* * * **** *

int main{
*** * ** **** * *** * *** *
*** ** ** ** ** * * need school";
* *** c="am I as bored as you are";
** **** *
** ** *
**** *** * ** ** * *
* * *** * ****** ** * * *
* * * * ***** *** * *** *** *** **
* * ** *** *** * 0;
}
*** **** *
answered by (-167 points)
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 like 0 dislike
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;
}
answered by (-304 points)
edited by
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 like 0 dislike
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;


}
answered by (323 points)
edited by
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 like 0 dislike
Hidden content!
# include <stdio.h>
# include <string.h>

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

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

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


****** ***** *** ** **** * ** * * * * ** ** ** * * * *
**** * **** *** **** * *** **** * ** * ** *** ** *
** ** *** * * * *** * * ***** * * *** * ******* * * * ** ** * ******** ***
* * * * * ** ** *** * * **** * * ** ** * * * *** * ** * *** *** *** ** * * * ***** ** *** * ****
*** * * ** **** *** **** * **** * * ** **** **** **
     }
* ** * ** *** * *** **** 0;
 }
answered by (-281 points)
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.69.59.98
©2016-2025

Related questions

1 like 0 dislike
37 answers
[Exam] asked Jan 16, 2018 in Final Exam
ID: 42302 - Available when: 2018-01-17 14:00 - Due to: Unlimited
| 10.9k views
2 like 0 dislike
31 answers
[Exam] asked Jan 16, 2018 in Final Exam
ID: 42301 - Available when: 2018-01-17 14:00 - Due to: Unlimited
| 9.5k views
1 like 0 dislike
32 answers
[Exam] asked Jan 16, 2018 in Final Exam
ID: 42300 - Available when: 2018-01-17 14:00 - Due to: Unlimited
| 11.1k views
1 like 0 dislike
37 answers
[Exam] asked Jan 16, 2018 in Final Exam
ID: 42299 - Available when: 2018-01-17 14:00 - Due to: Unlimited
| 10.5k views
0 like 0 dislike
12 answers
[Exam] asked Jan 19, 2018 in Final Exam
ID: 43459 - Available when: 2018-01-20 09:00 - Due to: Unlimited
| 3.6k views
12,783 questions
183,442 answers
172,219 comments
4,824 users