2 like 0 dislike
7.1k 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 | 7.1k views

30 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(){
*** * * * * * * *** str1[100], str2[100]={0};
* * ***** ** * *** ***** i,j;

** * * **** ** ** * ** = revv(str1);
** * ** * **** * ***
* * *** * * ** * * * * * * ** *** ** * *
** ** * ** ** * * * *
** ** ****** * ** * * * ** **** *****
* * * ******** ** ** * ** ** * ** **** * * * *** * *
* ****** *** *** ********* **** * ** * * ** *** * ** *** **** * *
* *** * *** ****** * **** * ******* *** * * *

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

*** * * ** *** * ** **** ** 0;

* ** * * * * ****
answered by (-74 points)
0 0
prog.c: In function 'main':
prog.c:10:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(str1);
     ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/ccogzcoe.o: In function `main':
prog.c:(.text+0x43): warning: the `gets' function is dangerous and should not be used.
0 like 0 dislike
Hidden content!
#include * *** ** * * *
#include * * * * ** *
** ** *** ** * *

int main()
{
** **** * ** ** ** ** * * * * * *

* * ***** * * *** * ***** %s ** **** * * * **** * * * ****
* * * ** ** * *** ** ** * ** **** %s * *** str3, str2, str1);


* * ** ** * * * * * * ** 0;
}
answered by (-168 points)
0 0
prog.c: In function 'main':
prog.c:9:13: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[10]' [-Wformat=]
     scanf("%s %s %s", &str1, &str2, &str3);
             ^
prog.c:9:16: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'char (*)[10]' [-Wformat=]
     scanf("%s %s %s", &str1, &str2, &str3);
                ^
prog.c:9:19: warning: format '%s' expects argument of type 'char *', but argument 4 has type 'char (*)[10]' [-Wformat=]
     scanf("%s %s %s", &str1, &str2, &str3);
                   ^
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
#define MAX_SIZE 100

int main()
{

** * **** * * ** ** * ***** str[1000], reverse[1000];
**** * ****** *** * ** len, i, index=0, wordStart, wordEnd;

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

****** *** * ** * ***   = strlen(str);


* ******* ** * * * * ** * *** = len - 1;
*** ** ** **** * ** * *   = len - 1;

**** ** **** *** ***** ******** > 0)
    {

* * ** ** * ***** * ** * **** * * ** * == ' ')
* * ** *** * * ** **** * * * * ***** * **

** * * ****** ** * ***** * **** **** ** * * *** * *** ** **** * = wordStart + 1;
* * * * * ** ***** * * ** ** ** *** ** * * ** * ** ** * ** ** <= wordEnd)
* * * * * *** * ** * * * * * * ***** * *** * ****
*** ** * * * *** ** * ** *** *** ** ** * * * **** ** * *** * ** ** * * ** = str[i];

** *** * ** *** *** **** ***** ** ** ** * ** * ** ** *** * ** *** ***** * *** * * * **
* *** ** ********* * * ** * **** *** ** *** ****** * **** ***** **** * *** * ** * ****
* * * * ** ** ** * *** ***** *** ***** **** ** * * * * * * * *
** * ** * ** *** ** * ****** * ***** **** * *** * * ** * * * * * * * = ' ';

*** **** *** **** * ** ********* *** * ** * *** * * * * ** ******* ** * = wordStart - 1;
** ** ** *** * ** * ** * * * * * ** * * *** **

*** **** ** * ** * * * **** ** * **** **** * *
    }


* * * * *** * * i<=wordEnd; i++)
*** ** * *** *** ********
*** **** * *** **** * * ** ** ** * * ** * ** * * = str[i];
* *** ** *** ** *** ** *** * * * * *** * ** *
    }

* * **** * ***** * ** **** = '\0';

* * ** *** * ***** * (i=0;i<strlen(reverse);i++){
* **** ** ****** *** * ** ** **** **** * (reverse[i]=='\n')
* **** * *** * * *** ***** * * * * *** * *** * ** * * * * ** ***
** * * * * * *** * * * * *** * * *****
* ** * ** ** * ** * * ** *** ** * * **** * * * ** ** ** *** ***** ** *** * ** * *
    }
 return 0;
}
answered by (-254 points)
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>
#include <ctype.h>
int main()
{
* * *** ** ** ** * * ** sentence[999], result[999];
* * * * ** * ** ** ****** *** ***
    int word_start, word_end, i, j, len;
    len = strlen(sentence);
**** * * **** ** ** = len -1;
*** * * ** ***** * * *** = len -1;
* ** * * * ** *

*** *** * ** *** **** * ** **** **
    {
** ** * *** *** ** * * * *** **** ** * * * * **** * * ')
** * ********* *** * ** * * ** * *** * * ** *
*** * *** ******* * * ***** *** * ** * ** ** * * *** * *** ** * * *
* * ** ******** ** * * * ** ** ** * ** ***** * * **** * * ** *
* * * **** ** * *** *** *** ** * ** ******* * ** ***** * * *** ** **** * * ** ** ** * **
** * * * * * * ****** **** * ** * * * * * * * ***** * ** *** ***** * ** ** * ***** *
* * ** *** * ** * * * **** ***** **** **** ***** *** ** * *
* **** * * *** * ** * * * * * *** *** * ** * ** ***** ** ** * ';
* * * *** ** * * *** *** * * * * **** ** * * ** ******
* * *** ** ** ** * * ******* * **** * ** * * **** * * * ** * * * * *
*** ** ** * ** * ** * * * * * * ***
** * * ** ** * * * ** ** * *** ***** * ** *
    }

**** **** ** ** ****** * *** *** **** * * *
    {
* ****** ****** ****** ** ** * * ** ** **** * *** * * ****
****** *** ****** * ** * ** * * ** * * * *
    }
* **** * * ** *** ******

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

//i love you

* ** * ***** * * * 0;
}
answered by (-196 points)
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!
** ** **** * **
** * * ** ** **

int main()
{
 int i=0,j=0;
 char * * ** *
*** ***** * ****
 
* * * ***
 {
* ****** ** *** **
* *** **** * * *
* * *
* * * * * * * *
* * *** * **
* *** ** * ****** *
* * ** * *** *** ** * ** *
* * * ** **** ** **
* **** * **  
***** ** * * *
 } **** *******
** **** **** *
 {
** **** *** * * * * * * * ***
 } ** *** * *
** * * *** ** ** * * ** ***
*** * *** 0; * * *** *
}
30/100 answered by (-66 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(){
    int b,c,end;
    char a[100];
** * ** * ***** ** **** **** * * **
    end=strlen(a)-1;
* ***** ** * ** ** * ** *** * * * * ***
** ** ** *** * * **** * ** * *** **** * '){
********* ****** * * * * * ** * * * * * * **** ***** * * * ** * ** ******* * ** *** * * * * ****** *
* * ** ** ** * ** * * ***** ** * * ** * * **** *** * * * *** *** *** ** *** * *** ** * *** *** * *** ** * * * *
** ** ** * * ** * ** *** * *** **** * * ****** * * *** ****** * * * * * * *** **
* * ** * ** **** * * ** * * * * * * ****** * * *** * *** *** *** *** * ** * ** * * * * * ***
** ** * * ** ** * *** * * ***** * *** ** ** ** ** * * * *** *** ** ** ** *** * * *** * * ");
* **** * ** ***** ** * * * ** * * ** * *
    }
** ** *** * * ** * ** *** **
*** ** **** * ** **** **** * * * * * *** * **** ** * * * * ** * ** *** * * *** *** *
**** **** * ** * ** ** * * ** ***
    return 0;
}
75/100 answered by (-498 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct 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:9: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
     end=strlen(a)-1;
         ^~~~~~
prog.c:8:9: warning: incompatible implicit declaration of built-in function 'strlen'
prog.c:8:9: 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: 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 like 0 dislike
Hidden content!
#include * ** *
** ** * * **
int main (){
char * * *
****** * * * * ** * * * **
***** ** * *** * *
* * ** * ****
* * **** **
*****
** **
** ***** * *
}
return 0;
}
answered by (16 points)
0 0
prog.c: In function 'main':
prog.c:6:9: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[100]' [-Wformat=]
 scanf("%s",&a);
         ^
prog.c:7:5: error: 'i' undeclared (first use in this function)
 for(i=0;i<a[i];i++)
     ^
prog.c:7:5: note: each undeclared identifier is reported only once for each function it appears in
prog.c: At top level:
prog.c:13:1: error: expected identifier or '(' before 'return'
 return 0;
 ^~~~~~
prog.c:14:1: error: expected identifier or '(' before '}' token
 }
 ^
0 like 0 dislike
Hidden content!
#include * ** * *
#include * * *** * * *
#include * * * ** ** *

int main()
{
* ** *** * * * * *** * a[999];

*** ** ** **** *** * * i;

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



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

* ** * ** * *** 0;
}
answered by (-16 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
0 0
prog.c: In function 'main':
prog.c:11:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(a,999,stdin);
     ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
prog.c:11:5: error: too many arguments to function 'gets'
     gets(a,999,stdin);
     ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
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:15:5: error: expected ';' before 'fputs'
     fputs(a,stdout)
     ^~~~~
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 <stdlib.h>
#include <string.h>

char A[100],i,j,limit;

int main()
{
** *** ***** ** * ***** * *
* ** *** * * * * * **** * ** * **
* * *** *** ** ** * * **
**** * * * * ** * ** * *** * ** * *** * ***** * ** ** '||i==0){
* ** ** **** ** *** * * ** ** * * ** * * *** * * ** * ******* ');
* * * ** * *** * * ** * * * ** ******* ** ** * **** ******* *** * *** ** **
* ** ** * ** * *** * ** *** * * * * ** * *** * * ** *** * *** ** ** * ******* ********* **** * ");}
** *** * ***** * * * **** ****** ** *** ** * * * **** ** ** * * * ** **** * '){printf("%c",A[j]);}
***** **** * * * *** **** *** * * *** * * ** * ** * *** * **** * * *** * ** * ** ****** *** ** *
***** ***** *** * * * * * * ** * ** * *** *** * *** * * * *
* ***** * *** * * * * *** ** *** * * * * *** * * * * ** * ******** * * * * * * ");}

* ** * * ***** *** ** **** ** ** *** *** *** ** * ** ** ***** = i;

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

    }
    return 0;
}
75/100 answered by (-286 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()
{
    char arr[999];
    int i,j,n;
** ** ** * * * * * * * * ** * * * * ** * *
**** * * * ** ** ** ** ***
    for (i=strlen(arr);i>=0;i--)
    {
* ** ** **** * * * * * ** * ** * ** (arr[i]==' ')
* *** * * * * * * * ** ****** * * * *
* ***** ** * *** * *** * * * * ** ** *** * ** * * ** * ** * * * * (j=i+1;j<n;j++)
* * ** *** ** * * ****** * * ** **** * ***** * *** ** ** ** * ** **** * *** * ** *** ** * ** ** * *
* ** **** * ** * ** * *** * * * ** * * * * * *** * ** ** * ******* ");
* * **** *** * ** ** ***** * ** **** * *** ***** ***** * *
** *** ** **** *** ***** * * * **** ** * *
*** ***** ** ***** * ** * * * * * ** * * if (i==0)
** * * * *** ** ** ** * *** * *** ** *
** **** * *** * **** *** * ** ** * * *** * * ** * * *** *** **** (j=0;j<n;j++)
* **** ** **** * ** * * * * * * *** * * * * * * *** ** ** *
** **** *** *** * ** * * * * ** * ** ** ********** * * ** * ** **** * * **** * *** ** ** ** **** *
* ** * ** ** * ** * * * * * * * * **** *** ** **** * *** * *** ** *
*** ** * * * * * * ***** **** **** * *
    }
** *** * * ** * * **** * 0;
}
answered by (-249 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.59.175
©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
| 8.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
| 7.8k 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
| 9k 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
| 8.6k 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
| 2.9k views
12,783 questions
183,442 answers
172,219 comments
4,824 users