中易网

Error (char * message)函数是什么意思

答案:2  悬赏:30  
解决时间 2021-02-21 22:08
#include
#include
#include
typedef int DataType;
typedef struct stacknode {
DataType data;
struct stacknode * next;
}StackNode;

typedef struct {
StackNode * top;
}LinkStack;

//错误信息
Error (char * message)
{
printf ("Erroe:%s",message);
exit (1);
}*/

//初始化链栈
void InitStack (LinkStack * s)
{
s->top = NULL;
}
//判栈空
int StackEmpty (LinkStack * s)
{
return s->top == NULL;
}
//入栈
void Push (LinkStack * s , DataType x)
{
StackNode * p = (StackNode * ) malloc (sizeof(StackNode));
p->data = x;
p->next = s->top;
s->top = p;
}
//出栈
DataType Pop(LinkStack *s)
{
DataType x;
StackNode * p = s->top;
if ( StackEmpty (s))
// Error ("下溢");
x = p->data;
s->top = p->next;
free (p);
return x;
}
//取栈顶
DataType StackTop (LinkStack* s)
{
if (StackEmpty (s))
// Error ("栈为空");
return s->top->data;
}
//数值转换
void MultiBaseOutput (int N,int B)
{
int i;
LinkStack s;
InitStack (&s);
while (N){
Push (&s,N%B);
N=N/B;
}
while (! StackEmpty(&s)){
i=Pop (&s);
printf ("%d'",i);
}
}
void main()
{
int N,B,i;
char ch = 'N';
i=1;

while (i){
printf ("请输入要转换的正整数");
scanf ("%d",&N);

if ((int)N!=N||N<=0)
printf ("请输入正整数!\n");
else
i=0;
}
i=1;
while (i){
printf ("请输转换的进制");
scanf ("%d",&B);

if ((int)B!=B||B<=1)
printf ("请输入大于的正整数!\n");
else
i = 0;
}
i = 1;
printf ("%d的%d进制为:",N,B);
MultiBaseOutput (N,B);
N=B=0;

}

这个中的'错误信息函数是什么意思'
望高手指点
最佳答案
#include
#include
#include
#include
typedef int DataType;
typedef struct stacknode {
DataType data;
struct stacknode * next;
}StackNode;

typedef struct {
StackNode * top;
}LinkStack;

//错误信息
void Error(char * message)
{
printf ("Erroe:%s",message);
exit (1);
}

//初始化链栈
void InitStack (LinkStack * s)
{
s->top = NULL;
}
//判栈空
int StackEmpty (LinkStack * s)
{
return s->top == NULL;
}
//入栈
void Push (LinkStack * s , DataType x)
{
StackNode * p = (StackNode * ) malloc (sizeof(StackNode));
p->data = x;
p->next = s->top;
s->top = p;
}
//出栈
DataType Pop(LinkStack *s)
{
DataType x;
StackNode * p = s->top;
if ( StackEmpty (s))
Error ("下溢");
x = p->data;
s->top = p->next;
free (p);
return x;
}
//取栈顶
DataType StackTop (LinkStack* s)
{
if (StackEmpty (s))
// Error ("栈为空");
return s->top->data;
}
//数值转换
void MultiBaseOutput (int N,int B)
{
int i;
LinkStack s;
InitStack (&s);
while (N){
Push (&s,N%B);
N=N/B;
}
while (! StackEmpty(&s)){
i=Pop (&s);
printf ("%d'",i);
}
}

void main()
{
int N,B,i;
char ch = 'N';
i=1;

while (i){
printf ("请输入要转换的正整数");
scanf ("%d",&N);

if ((int)N!=N||N<=0)
{
printf ("请输入正整数!\n");
}
else
i=0;
}
i=1;
while (i){
printf ("请输转换的进制");
scanf ("%d",&B);

if ((int)B!=B||B<=1)
printf ("请输入大于的正整数!\n");
else
i = 0;
}
i = 1;
printf ("%d的%d进制为:",N,B);
MultiBaseOutput (N,B);
N=B=0;

}
ERROR那里没有函数类型
全部回答

char 可以隐式转换为 ushort、int、uint、long、ulong、float、double 或 decimal。但是,不存在从其他类型到 char 类型的隐式转换。

system.char 类型提供几个处理 char 值的静态方法。

public static void main() { char cha = 'a'; char ch1 = '1'; string str = "test string"; console.writeline(cha.compareto('b')); // output: "-1" (meaning 'a' is 1 less than 'b') console.writeline(cha.equals('a')); // output: "true" console.writeline(char.getnumericvalue(ch1)); // output: "1" console.writeline(char.iscontrol('\t')); // output: "true" console.writeline(char.isdigit(ch1)); // output: "true" console.writeline(char.isletter(',')); // output: "false" console.writeline(char.islower('u')); // output: "true" console.writeline(char.isnumber(ch1)); // output: "true" console.writeline(char.ispunctuation('.')); // output: "true" console.writeline(char.isseparator(str, 4)); // output: "true" console.writeline(char.issymbol('+')); // output: "true" console.writeline(char.iswhitespace(str, 4)); // output: "true" console.writeline(char.parse("s")); // output: "s" console.writeline(char.tolower('m')); // output: "m" console.writeline('x'.tostring()); // output: "x" } 以上都是char的一些常用的方法,可以用来判断输入的字符是否是数字或者字母,或者判断大小写都可以,我最新做的一个项目就用到了,希望对楼主有用,我是学c#的

我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
怎样将懒孩子变成勤快的人?
天津一汽的骏派d60和哈弗h2 起亚k2应该买哪个
打算在新泰租房的话,中介看个房子20吗?成交
赤峰雷蒙大药房NO.299地址在什么地方,想过去
九龙坡区公安局怎么走啊?
主角名为沈旭的都市重生小说叫什么名字
腾太装饰怎么去啊,有知道地址的么
镇江金山在什么地方啊
CPU AMD245 主板:微星785GM-P45,加个什么显
吉林省荣浩保险代理有限公司通榆平安分公司怎
羊肉胸茬是羊身上的那个部分
女孩子名字什么倩好听
热血传奇手机版限时不小号什么意思
雄屯村这个地址在什么地方,我要处理点事
什么时候买家具最便宜?
推荐资讯
为什么腾讯QQ更新后越来越不好用了
主卫对着床,想在主卫和床之间做个L型衣帽间
北京石景山刘娘府北河沿拆迁,是按户口人员分
宏达鞋业地址在什么地方,想过去办事
兴义君安医院地址在哪,我要去那里办事
IORI在什么地方啊,我要过去处理事情
中国移动通信手机连锁超市易兴车站店怎么去啊
我经常做梦梦见一些稀奇古怪的东西,多是鬼神
热血奥特超人之超人崛起破解
吉林8月28号天气预报查询
交园驾校(回龙观校区)怎么去啊,有知道地址的
没有读卡器电脑上的的东西能不能传到手机的储
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?