(你好,我是在百度上看到你的,我觉得你对C语言很熟悉,所以冒昧向你请教一个问题可以吗)
2个回答
展开全部
#include <stdio.h>
#define ArrSize 10
#define scanf(format, ...) do {scanf(format, __VA_ARGS__); while(getchar()!='\n') continue;} while(0)
static void CFCrossPlatformUnicodeSupport(void);
int main(int argc, char *argv[])
{
CFCrossPlatformUnicodeSupport();
double results[ArrSize];
int i = 0;
printf("成绩登记:\n");
for(; i<=ArrSize; i++)
{
printf("请输入第%2d个同学的成绩:", i);
scanf("%lf", results+i);
}
printf("成绩如下:\n");
for(i = 0; i<=ArrSize; i++)
printf("第%2d个同学的成绩:%g\n", i, results[i]);
return 0;
}
// ----- Cross Platform Support -----
#if defined(__APPLE__) && defined(__GNUC__)
# define CF_OS_MACX
#elif defined(__MACOSX__)
# define CF_OS_MACX
#elif defined(macintosh)
# define CF_OS_MAC9
#elif defined(__CYGWIN__)
# define CF_OS_CYGWIN
#elif defined(MSDOS) || defined(_MSDOS)
# define CF_OS_MSDOS
#elif defined(__OS2__)
# if defined(__EMX__)
# define CF_OS_OS2EMX
# else
# define CF_OS_OS2
# endif
#elif !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
# define CF_OS_WIN32
# define CF_OS_WIN64
#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
# define CF_OS_WIN32
#elif defined(__MWERKS__) && defined(__INTEL__)
# define CF_OS_WIN32
#elif defined(__sun) || defined(sun)
# define CF_OS_SOLARIS
#elif defined(hpux) || defined(__hpux)
# define CF_OS_HPUX
#elif defined(__ultrix) || defined(ultrix)
# define CF_OS_ULTRIX
#elif defined(sinix)
# define CF_OS_RELIANT
#elif defined(__linux__) || defined(__linux)
# define CF_OS_LINUX
#elif defined(__FreeBSD__)
# define CF_OS_FREEBSD
# define CF_OS_BSD4
#elif defined(__NetBSD__)
# define CF_OS_NETBSD
# define CF_OS_BSD4
#elif defined(__OpenBSD__)
# define CF_OS_OPENBSD
# define CF_OS_BSD4
#elif defined(__bsdi__)
# define CF_OS_BSDI
# define CF_OS_BSD4
#elif defined(__sgi)
# define CF_OS_IRIX
#elif defined(__osf__)
# define CF_OS_OSF
#elif defined(_AIX)
# define CF_OS_AIX
#elif defined(__Lynx__)
# define CF_OS_LYNX
#elif defined(__GNU_HURD__)
# define CF_OS_HURD
#elif defined(__DGUX__)
# define CF_OS_DGUX
#elif defined(__QNXNTO__)
# define CF_OS_QNX6
#elif defined(__QNX__)
# define CF_OS_QNX
#elif defined(_SEQUENT_)
# define CF_OS_DYNIX
#elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */
# define CF_OS_SCO
#elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */
# define CF_OS_UNIXWARE
# define CF_OS_UNIXWARE7
#elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */
# define CF_OS_UNIXWARE
# define CF_OS_UNIXWARE7
#else
# error CFFundation has not been ported to this OS
#endif
#if defined(CF_OS_MAC9) || defined(CF_OS_MACX)
# define CF_OS_MAC
#endif
#if defined(CF_OS_WIN32) || defined(CF_OS_WIN64)
# define CF_OS_WIN
#endif
#if defined(CF_OS_MAC9) || defined(CF_OS_MSDOS) || defined(CF_OS_OS2) || defined(CF_OS_WIN32) || defined(CF_OS_WIN64)
# undef CF_OS_UNIX
#elif !defined(CF_OS_UNIX)
# define CF_OS_UNIX
#endif
#include <locale.h>
#ifdef CF_OS_WIN
#include <fcntl.h>
#endif
static void CFCrossPlatformUnicodeSupport(void)
{
#ifdef CF_OS_WIN
_setmode(_fileno(stdout), _O_U16TEXT);
#elif defined CF_OS_MAC
setlocale(LC_CTYPE, "zh_CN");
// for a list of available locales, please type "locale -a" in Unix-related terminal
#else
#warning CFCrossPlatformUnicodeSupport may not support current platform
#endif
}
更多追问追答
追问
你好,这好像运行不了呢,是我哪里弄错了吗
追答
那你把#error那一行删了吧
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
运算12345/10000得要万位数1, 12345%10000就是2345,然后再2345/1000,得到千位数2, ……345/100,得到百位数3,以此类推最外面用个for语句循环方法二 将这些数作为一个数组输入 char str[12]
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询