0 喜歡 0 不喜歡
9.5k 瀏覽

Please write a program using at least one function to receive a number '2018', then outputs Happy_New_Year_2018!!  For other numbers received it will show those numbers instead.

Input 1 

2018

Output 1

2018
Happy_New_Year_2018!!

 

Input 2

69

Output  2

69
69

[練習] Coding (C) - 最新提問 分類:Chapter 3: Branching, Looping and Functions | 用戶: (5.9k 分)
ID: 40236 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 9.5k 瀏覽

22 個回答

0 喜歡 0 不喜歡
內容已隱藏
#include * ***** ****
#include **** * *** *** *

int readNumber();
void *** * ** ** number);

int main(int argc, char *argv[])
{
* * * *
* * * * * a;
*** * * * *** * = readNumber();
*** * ** **
* * ** *
** ** * * *
***** * **** **** ** 0;
}

void *** ** number){
** ** * * *** ** * a;
* * * * ** ** *** (a == 2018){
* ***** ** ******* * *** **** **** ** *** * * ** * ** ** * * ** * * * * *
* * ******* * ** * * * *** else
* ***** ** * *** * **** *** ** *** *
*** * * **** * * * ** * *
}

int * *
* * ** ** * * ** *** x;
* ** **** ** ** * **** * &x);
* * ** * * * ** * * x; * * ** * * ** ** *
}
75/100 最新回答 用戶: (192 分)
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include ** * *
#include **** ** * * ****

int readNumber();
void * ** ** number);

int main(int argc, char *argv[])
{
* * ** * **
**** * **** a;
* * * ** = readNumber();
* * ** *
* ****** *
* * **** ** * * **** *
** * *** * * * 0;
}

void * ** number){
*** * *** * **** **** * a;
* * * ***** ** * * ** (a == 2018){
* * * *** * ** **** ****** ** * * * * ** ** * ** * **
** ** * **** * *** ** else
*** ** **** * ** ** * ****** * ** **** *
* * * ***** * ****** ** ** * * * **
}

int *
** * * *** *** *** * x;
** ** * ****** ** * * ****** * ** &x);
** *** ** ** * *** x; * * * * ** **
}
75/100 最新回答 用戶: (192 分)
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include * **
#include * ** *

int readNumber();
void ** ** * * number);

int main(int argc, char *argv[])
{
* * * * * **
**** * ** * ** a;
* * * * ** = readNumber();
* ** * *
*** ** ** *
****** * * ** * * *
** * * **** * 0;
}

void * * * number){
*** ** *** * * * * *** ***** a;
** * * * **** *** * (a == 2018){
** ** ** ** *** ** * * * * * ** * ** ** *** * *** * ** * * * * ** **
* *** ** * else
** ******* **** ** *** ** ***** *** ** *
*** ** * *** * ****** * * * * **
}

int ** *****
****** * * ** * ** * ** x;
** **** ** ******* * *** * ** * * &x);
****** * * * * ** ** *** x; ***** ****
}
75/100 最新回答 用戶: (183 分)
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include * * ** *
#include ** ** * ** * *

int readNumber();

int main(int argc, char *argv[])
{
* ***** ****
* * ** * *** a;
****** * = readNumber();
* * *** ** a == 2018)
******* *** ** *** ****** * ** * * * **** *** * * *** * * ***
*** **** * **
** * ** * * ** * * *** ** ** *** * * **** * a);

*** ***
***** * * ** **** ********* *** * * ** **
* * ** * ** ** 0;
}


int ** * *
* * *** *** * * * *** ** x;
** * ** *** ** * * **** ***** * * * ** &x);
** * * **** **** ** * x; ****** ********
}
100/100 最新回答
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
** * * * * ** ** ******
* * * ** *** * *

int main(){
* *** *   int n;
* ****  
  *** * * **** * * * *
* ** * * * *
* * * *** ** **
** * *** * * **** * ** * *** * * * * * * ***
* * * ** }else{
* **** * * *** * * *** ** *** * * * * *
** ** * * * }
}
50/100 最新回答 用戶: (244 分)
0 0
prog.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
 include<stdio.h>
        ^
In file included from prog.c:2:0:
/usr/include/stdlib.h:100:8: error: unknown type name 'size_t'
 extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
        ^~~~~~
/usr/include/stdlib.h:427:22: error: unknown type name 'size_t'
 extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
                      ^~~~~~
/usr/include/stdlib.h:429:22: error: unknown type name 'size_t'
 extern void *calloc (size_t __nmemb, size_t __size)
                      ^~~~~~
/usr/include/stdlib.h:429:38: error: unknown type name 'size_t'
 extern void *calloc (size_t __nmemb, size_t __size)
                                      ^~~~~~
/usr/include/stdlib.h:441:36: error: unknown type name 'size_t'
 extern void *realloc (void *__ptr, size_t __size)
                                    ^~~~~~
/usr/include/stdlib.h:716:9: error: unknown type name 'size_t'
         size_t __nmemb, size_t __size, __compar_fn_t __compar)
         ^~~~~~
/usr/include/stdlib.h:716:25: error: unknown type name 'size_t'
         size_t __nmemb, size_t __size, __compar_fn_t __compar)
                         ^~~~~~
/usr/include/stdlib.h:725:34: error: unknown type name 'size_t'
 extern void qsort (void *__base, size_t __nmemb, size_t __size,
                                  ^~~~~~
/usr/include/stdlib.h:725:50: error: unknown type name 'size_t'
 extern void qsort (void *__base, size_t __nmemb, size_t __size,
                                                  ^~~~~~
/usr/include/stdlib.h:823:36: error: unknown type name 'size_t'
 extern int mblen (const char *__s, size_t __n) __THROW;
                                    ^~~~~~
/usr/include/stdlib.h:827:34: error: unknown type name 'size_t'
      const char *__restrict __s, size_t __n) __THROW;
                                  ^~~~~~
/usr/include/stdlib.h:834:8: error: unknown type name 'size_t'
 extern size_t mbstowcs (wchar_t *__restrict  __pwcs,
        ^~~~~~
/usr/include/stdlib.h:835:32: error: unknown type name 'size_t'
    const char *__restrict __s, size_t __n) __THROW;
                                ^~~~~~
/usr/include/stdlib.h:837:8: error: unknown type name 'size_t'
 extern size_t wcstombs (char *__restrict __s,
        ^~~~~~
/usr/include/stdlib.h:838:38: error: unknown type name 'size_t'
    const wchar_t *__restrict __pwcs, size_t __n)
                                      ^~~~~~
prog.c: In function 'main':
prog.c:7:2: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
  scanf("%d",&n);
  ^~~~~
prog.c:7:2: warning: incompatible implicit declaration of built-in function 'scanf'
prog.c:7:2: note: include '<stdio.h>' or provide a declaration of 'scanf'
prog.c:10:3: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   printf("Happy_New_Year2018!!");
   ^~~~~~
prog.c:10:3: warning: incompatible implicit declaration of built-in function 'printf'
prog.c:10:3: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:12:3: warning: incompatible implicit declaration of built-in function 'printf'
   printf("%d",n);
   ^~~~~~
prog.c:12:3: note: include '<stdio.h>' or provide a declaration of 'printf'
0 0
# is missing
0 喜歡 0 不喜歡
內容已隱藏
* ** * * ** ***
* ** * * * * * **

/* run this * ** using the pauser or add your own getch, * ** **** * ** * * or input loop */

int * * argc, char * * ** {
int a;
**** * * * * ** ** *** ** ** * ***
** **** * *** **
* ** **** * * ** * * * * * *** * *
* *** * * }
*** *** ** *** * * *** * * ***
*** * * * ** * * ** *** **** * ** * * *** ******* *
* * ** * * * * ** ***
* * *** * * * * * * *
* * * * * * 0;
**** ***** *

* * * **
100/100 最新回答 用戶: (227 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
* * *** ***
*** * ** ** * ***

/* run this program using the * pauser or add your own getch, * * **** * ** * or input loop */

int *** argc, char * ** {
int a;
** * * ** ** ** * * * ** * *** ** **
*** * * ** * *
* * ***** * * * ** * ** * * * * *****
* ** * * ** * **** * * *** * * ** * * ** * ** ** ***
*** * }
** ** * ** ***
* * *** * *** * ** ** * ** * *** * * * *** ** ** **
* * ** * *** *****
***** * * * *** * ***** * *
****** **** return 0;
*** ** ** **
最新回答 用戶: (227 分)
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
** * * **** * ***
* **** * ** ** * *

/* run this *** * * the * * or add your own * * *** * *** * * or ** loop */

int * char ** * {
** *
*** ** * int **
* * ** ** ** ** *** **** *** * * *
* **** * * == * *
* * * * * * *** * * *** * *** * * ** ***
}
* ***** * ***** else
** *** * ** ** * * * * *
* * * * ** *
** *
* * ***
*** * ** ** * 0;
}
100/100 最新回答 用戶: (221 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Nice job. However, considering using at least one function would satisfy the question.
0 喜歡 0 不喜歡
內容已隱藏
*** * * * * * ** *

int * argc, ** argv) {
* * ** int n;
* * ** ***** *** * * **** * *
* * * * ** if(n == **
*** * **** *** * *** * * * ***** ***
** * ** **** * }
* * ** ***** else * *** ** ** * *
* ** ** * * * return 0;
}
100/100 最新回答 用戶: (220 分)
修改於 用戶:
0 0
prog.c:1:20: fatal error: iostream: No such file or directory
 #include <iostream>
                    ^
compilation terminated.
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include * *** * ** *

int xyz(){
* * ** ***** * *** * a;
**** *** * * * ******* ** **** * * * ** ** * * * &a);
* * ** * *** **** * ** a;
**** ** * * ** *** ****

int main(int argc, char *argv[])
{
    int a = xyz();
* * * * * * *** *
** *** ***** *
* * * **** ****** *** *** == 2018){
* ** * *** ** **** * *** * * *** * ** **** * ** * * * ** * ** * * ** a);
* * **** *** ** * *
* * *** * * * * * *
**** ***** * ** *** ** * * * * * ** * * * * **** * * ** a);
* ** ** * * * * * **

* * ****** * * * * * *** *** *
80/100 最新回答 用戶: (269 分)
0 0
prog.c: In function 'main':
prog.c:12:2: error: stray '\302' in program
  \xc2\xa0 \xc2\xa0int a = xyz();
  ^
prog.c:12:3: error: stray '\240' in program
  \xc2\xa0 \xc2\xa0int a = xyz();
   ^
prog.c:12:5: error: stray '\302' in program
  \xc2\xa0 \xc2\xa0int a = xyz();
     ^
prog.c:12:6: error: stray '\240' in program
  \xc2\xa0 \xc2\xa0int a = xyz();
      ^
prog.c:22:3: error: expected declaration or statement at end of input
   system("PAUSE");
   ^~~~~~
0 0
The program doesn't end yet. Something is missing.
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:104.23.243.108
©2016-2026

相關問題

0 喜歡 0 不喜歡
18 回答
[練習] 克漏字填空 - 最新提問 12月 23, 2017 分類:Chapter 3: Branching, Looping and Functions | 用戶: nat236919 (5.9k 分)
ID: 39813 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 3.9k 瀏覽
0 喜歡 0 不喜歡
16 回答
[練習] Coding (C) - 最新提問 12月 23, 2017 分類:Chapter 3: Branching, Looping and Functions | 用戶: nat236919 (5.9k 分)
ID: 39810 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 6.9k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶