① 汇编想输出数字却输出乱码
你这个语句的功能是输出字符串,但是你需要自己设置字符串的地址,ds:dx=字符串的地址,而且这个字符串还要以$结束。目前乱码是应该是指向了一个未知的地方导致的。
下面的代码因为没有编译环境,因此未做验证,仅做参考
assume
cs:cseg,ds:dseg
dseg
segment
db
'test$'
dseg
ends
cseg
segment
start:
mov
ax,dseg
mov
ds,ax
mov
dx,0
mov
ah,9
int
21h
cseg
ends
end
start
② C++ 使用模板函数,分别对整型、单精度、双精度的数据排序。 编译连接都没问题,为什么结果有乱码
那不是乱码,是输出间隔太小,把较长的数据连到一起了。提供两个措施供参考:
把输出间隔变大。
控制小数点位数。
③ c语言帮忙改错 插入编译连接无问题但结果是乱码
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//主函数
#defineSIZEsizeof(structstu_node)
structstu_node{
intnum;
charname[20];
intscore;
structstu_node*next;
};
intn; //n表示表中节点的个数
structstu_node*Init_stu();//链表初始化
structstu_node*create_stu(); //按输入顺序建立单向链表
voidprint_stu(structstu_node*head); //遍历
voidinsert_stu(structstu_node*head,structstu_node*s);//插入
intdelete_stu(structstu_node*head,intnum);//删除
intmain(){
structstu_node*p,*head=Init_stu();
intchoice,num;
do{
printf("请选择菜单(0-4): ");
printf(" 1.建立链表 2.插入 3.删除 4.遍历 0.退出 ");
scanf("%d",&choice);
if(choice>1&&head->next==NULL){
printf("链表尚未建立,请先选择1。 ");
break;
}
switch(choice){
case0:break;
case1:head=create_stu();break;
case2:printf("请输入待插入的学生信息: ");
// p=(structstu_node*)malloc(n*SIZE);
p=(structstu_node*)malloc(SIZE);
scanf("%d%s%d",&p->num,p->name,&p->score);
insert_stu(head,p);
free(p);
break;
case3:printf("请输入待删除的学生学号:");
scanf("%d",&num);
delete_stu(head,num);
break;
case4:print_stu(head);
default:printf("不能识别的选择:%d,请重新选择。 ",choice);
break;
}
}while(choice);
return0;
}
structstu_node*Init_stu(){
structstu_node*head=(structstu_node*)malloc(sizeof(SIZE));
if(head==NULL){
printf("内存分配失败! ");
returnNULL;
}
head->next=NULL;
returnhead;
}
//建立链表
structstu_node*create_stu(structstu_node*head){
structstu_node*p=head;
n=0;
intnum,score;
charname[20];
printf("请输入学号姓名成绩(学号为0时停止输入): ");
scanf("%d%s%d",&num,name,&score);
while(num){
p->next=(structstu_node*)malloc(SIZE);
p->next->num=num;
p->next->score=score;
strcpy(p->next->name,name);
p=p->next;
n++;
};
p->next=NULL;
returnhead;
}
//遍历链表
voidprint_stu(structstu_node*head){
structstu_node*p;
p=head->next;
if(head->next==NULL){
printf("空表,无记录 ");
return;
}
printf(" 学号 姓名 成绩 ");
while(p){
printf("%4d %s %d ",p->num,p->name,p->score);
p=p->next;
}
}
//插入
voidinsert_stu(structstu_node*head,structstu_node*s){
s->next=head->next;//直接插在头部作为链表的首节点
head->next=s;
}
//删除
intdelete_stu(structstu_node*head,intnum){
structstu_node*p=head,*q;
if(p->next==NULL){
printf("链表为空!删除操作失败! ");
return0;
}
while(p->next){
if(num==p->num){
q=p->next;
p=p->next;
free(q);
return1;
--n;
}
p=p->next;
}
printf("%d,表中无此节点! ",num);
return0;
}
④ 怎么编译前汉字显示正常,编译后就变成乱码了
你好,这个问题的原因主要在编码问题上,你可以在设置-编辑器中更改一下编码,如果你是Windows
Xp的话,请选择windows-936,找准对应的编码就行了。
或者直接更改菜单栏中的编辑-文件编码-系统默认,不过这种修改方法,需要每次编程时都要更改设置才行。
⑤ 数据结构数制的转换,程序编译正确,可是输出是乱码。怎么办
{
a[j]=n%2;
n=n/2;
m++;//这里不应该也要有j++吗 再来个j++看看
}
⑥ JAVA 编译能通过,但显示乱码
不太明白你的乱码是指的什么,单从程序看 你的代码是没问题的,可能是你其他环境影响,最好有截图
⑦ 如何解决VC++编译后出现数字乱码
情况1:可能是因为语言设置不正确。如果想在AppWizard生成的工程文件中使用中文,在在MFC AppWizard的第1步中选择中文资源,选择Chinese(P.R.C),如果你在语言列表中没有找到有关中文的选项,说明你的VC++的中文支持模块没有安装。此时,应退出VC++,在VC++的光盘的DevStudioSharedIDEBinIDE目录下找到APPWZCHS.DLL文件,将其拷贝到硬盘的DevStudioSharedIDEBinIDE目录下即可,再启动VC++,就可以看到这一选项了。使用这一选项生成的工程文件中的所有资源都是中文的。VC++还提供了繁体中文(APPWZCHT.DLL)、日文(APPWZJPN.DLL)和韩文(APPWZKOR.DLL)的支持模块。
这种情况就是语言设置问题,与本身无关
情况2: 如果你的工程中的菜单、对话框、字符串等资源不是由AppWizard生成的,而是手工添加的,你必须保证该资源的Language选项为Chinese(P.R.C)。具体的做法是在资源列表中选择资源,然后在快捷菜单中选择Properties,在话框中设置Language下拉框。如果在Language中选择English,尽管在集成环境中可以正常显示中文,但编译后就变成了诸如"___.???"之类的乱码了。
情况3:方法1: 有一个解决方案不必从头作起:找到rc文件(资源文件),把其中LANGUAGE 9, 1的地方改为4,2;codepage(1252)改为codepage(936);另外把#include "afxres.rc" 改成#include "l.chsafxres.rc";把"afxres.rc" 改成"l.chs\afxres.rc"即可,其中的数据根据不同文字代码可能不同。
希望能够帮到你!
【参考资料:网络经验】
⑧ c语言编译运行乱码是什么原因
这种情况多数是由于操作系统的语言选项不正确引起的。建议你查看一下控制面板中的区域和语言选项,特别是有关“非Unicode程序的语言”,一定要选择成“中文(简体,中国)”。然后重启电脑。
⑨ c语言代码编译通过,但输出时有乱码,什么原因
修改如下:
//---------------------------------------------------------------------------
#include<stdio.h>
void main()
{
void secret(char str1[],char str2[]); /*注意这里*/
char str1[10],str2[10]={0}; /*注意这里*/
int i;
printf("please input something");
gets(str1);
secret(str1,str2); /*注意这里*/
puts(str2); /*注意这里*/
}
void secret(char str1[],char str2[]) /*注意这里*/
{ int i;
for(i=0;i<10&&(str1[i])!=0;i++)
{
if (str1[i]<='z'&&str1[i]>='a')
str2[i]='0';
else
if (str1[i]<='Z'&&str1[i]>='A')
str2[i]='1';
else
if (str1[i]<='9'&&str1[i]>='0')
str2[i]='2';
else
if (str1[i]==' ')
str2[i]='3';
else
str2[i]='4';
}
/*注意这里*/
}
//---------------------------------------------------------------------------