c程序求查错 自己真找不出哪里错了 20C

test3.cpp

 #include<stdio.h>
#include<string.h>
#include<stdlib.h>

#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
#define OVERFLOW 0

typedef int Elemtype;

/*通讯录的结构*/
typedef struct MailList{
    int num;
    char name[20];
    char tel1[12];
    char tel2[12];
    char email[50];
}MailList;

/*用于恢复删除信息的结构*/
typedef struct DeleteList{
    MailList data;
    DeleteList *next;
}DeleteList,*LinkList;

/*顺序表的定义结构*/
 typedef struct{
    MailList *elem;   //存储空间基址 
    int length;       //当前长度 
    int Listsize;      //当前分配的存储容量 
}SqList;

int InitList_Sq(SqList &L);//初始化通讯录 
bool InitList_Delete(MailList &L);//初始化回收站 
int ListIsert_Sq(SqList &L,int i,Elemtype e);//插入数据 
void ShowAll(SqList &L);//显示全部通讯录内容 
int deleteList(SqList &L1,int i,MailList &e);//删除某一条并以e返回 
void ListInsert(LinkList &L,MailList x);//添加到回收站 
void WatchList(LinkList &L);//查看回收站 
bool find_int(SqList &L,int x);//按照编号查找数据 
void find_char(SqList &L,char x[]);//按照姓名查找数据 
bool recoverList(LinkList &L2,int n,MailList &e);//从回收站中删除并以e返回 
bool ChangeList(SqList &L1,int n);//修改信息 

#include"test3_Seq.h"
#include"test3_Link.h"

int main(void)
{
    SqList L1;
    InitList_Sq(L1);
    LinkList L2;
    InitList_Delete(L2);
    MailList M;
    int i = 1;
    printf("请创建新的通讯录,格式为:姓名 电话1 电话2 电子邮箱。(输入数字“0”结束)\n");
    while(1)
    {
        M.num = i;
        scanf("%s",M.name);
        if(M.name[0] == '0') break;
        scanf("%s %s %s",M.tel1,M.tel2,M.email);
        ListIsert_Sq(L1,M);
        i ++;
    }
    printf("输入成功!^_^\n");
    int number;
    while(1){
        printf("请输入数字进行相关操作\n1.查看通讯录\n2.查找通讯录\n3.添加通讯录\n4.修改通讯录\n5.删除通讯录\n6.查看已删除的通讯录\n7.恢复通讯录\n0.退出菜单\n");
        scanf("%d",&number);
        switch(number)
        {
            case 1:
                ShowAll(L1);
                break;
            case 2:
                int n,m;
                char find_name[20];
                printf("选择查找方式\n1.按编号查找\n2.按姓名查找\n");
                scanf("%d",&n); 
                if(n == 1)
                {
                    printf("请输入编号: ");
                    scanf("%d",&m);
                    find_int(L1,m);
                }
                else if(n == 2)
                {
                    printf("请输入姓名:  ");
                    scanf("%s",find_name);
                    find_char(L1,find_name); 
                }
                break;
            case 3: 
                printf("请输入你要添加的内容: ");
                M.num = i;  
                scanf("%s %s %s %s",M.name,M.tel1,M.tel2,M.email);
                ListIsert_Sq(L1,M);
                i ++;
                break;
            case 4:
                int c; 
                printf("请输入你要修改的条目编号: ");
                scanf("%d",&c);
                ChangeList(L1,c);
                break;
            case 5:     
                int a;
                printf("请输入你要删除的成员序号: ");
                scanf("%d",&a);
                MailList N;
                deleteList(L1,a,N);
                ListInsert(L2,N);
                break;
            case 6:
                WatchList(L2);
                break;
            case 7:
                int b;
                printf("请输入要还原的成员在回收站中的编号: ");
                scanf("%d",&b);
                recoverList(L2,b,M);
                ListIsert_Sq(L1,M);
                break;
            case 0:
                free(L1.elem);
                return 0;
            default:
                 printf("请输入正确的数字!\n");
                 break;
        }
    }
}

test_Link.h

 #include<stdio.h>
#include<stdlib.h>
//此函数用于创建链表
int InitList_Delete(LinkList &L)
{
    L = NULL;
    L = (LinkList)malloc(sizeof(DeleteList));
    if(L == NULL)  return 0;
    LinkList P = L -> next;
    P = NULL;
    return 1;
}

//此函数用于在链表中(回收站)插入元素
void ListInsert(LinkList &L,MailList x)
{
    LinkList p,q;
    p = L;
    while(p->next)
        p = p->next;
    q = (LinkList)malloc(sizeof(DeleteList));
    q->data = x;
    q->next = p->next;
    p->next = q;
    printf("删除成功!可在回收站中查看。\n");
}

//此函数用于查看回收站 
void WatchList(LinkList &L)
{
    LinkList p;
    p = L->next;
    while(p)
    {
        printf("%d %s %s %s %s\n",p->data.num,p->data.name,p->data.tel1,p->data.tel2,p->data.email);
        p = p->next;
    }
}

//此函数用于从回收站中删除数据并以e返回 
int recoverList(LinkList &L2,int n,MailList &e)
{
    LinkList p,q;
    int i,k = 0;
    q = L2->next;
    while(q){
        q = q->next;
        k ++;
    }
    if(n < 1 || n > k){
        printf("输入错误\n");
        return 0;
    }
    p = L2;
    for(i = 0;i < n - 1;i ++)
        p = p->next;
    e = p->next->data;
    p->next = p->next->next;
    printf("恢复成功!\n");
    return 1;
}

test_Seq.h

 #include<stdio.h>
#include<stdlib.h>
/*此函数用于初始化顺序表*/ 
int InitList_Sq(SqList &L)
{
    L.elem = (MailList *)malloc(LIST_INIT_SIZE*sizeof(MailList));  //为线性表分配100个空间 
    if(! L.elem) exit(OVERFLOW);    //如果分配失败则返回0
    L.length = 0;
    L.Listsize = LIST_INIT_SIZE;
    return 1;
}

//此函数用于删除第i条内容 
int deleteList(SqList &L1,int i,MailList &e)
{
    if((i<1)||(i>L1.length))
    {
        printf("请输入正确的数字!\n"); 
        return 0;
    }
    int j;
    e = L1.elem[i - 1];
    for(j = i;j <= L1.length -1;j ++)
    {
        L1.elem[j].num --;
        L1.elem[j - 1] = L1.elem[j];
    }
    L1.length --;
    return 1;
}

/*此函数用于在顺序表末尾插入数据元素*/
int ListIsert_Sq(SqList &L,MailList e)
{
    MailList *newbase ;
    if(L.length >=L.Listsize)
    {
        newbase = (MailList *)realloc(L.elem,(L.Listsize + LISTINCREMENT) * sizeof(MailList));
        if(! newbase) exit(OVERFLOW);
        L.elem = newbase;
        L.Listsize +=LISTINCREMENT;
    }
    MailList *p;
    p = &(L.elem[L.length]);
    *p = e;
    ++ L.length;
    return 1;
}

//此函数用于显示整个通讯录内容 
void ShowAll(SqList &L)
{
    MailList* p;
    p = &(L.elem[0]);
    for (p = &(L.elem[0]);p < &(L.elem[L.length]);p ++)
        printf("%d %s %s %s %s\n",p->num,p->name,p->tel1,p->tel2,p->email);
}



//此函数用于通过编号查找成员信息 
int find_int(SqList &L,int x)
{
    if(x < 1 || x > L.length)  
    {
        printf("编号不存在!\n");
        return 0;
    }
    MailList *p;
    int i;
    p = &(L.elem[0]);
    for(i = 1;i < x;i ++)
        p += 1;
    printf("%d %s %s %s %s\n",p->num,p->name,p->tel1,p->tel2,p->email);
} 

//此函数用于通过姓名查找成员信息 
void find_char(SqList &L,char x[])
{
    MailList* p;
    int h = 0,i;
    p = &(L.elem[0]);
    for(i = 0;i < L.length;i ++)
    {
        if(strcmp(p->name,x) == 0)
        {
            printf("%d %s %s %s %s\n",p->num,p->name,p->tel1,p->tel2,p->email);
            h = 1;
        }
        p ++;
    }
    if(h == 0)
        printf("编号不存在!\n");
}

//此函数用于修改成员信息
int ChangeList(SqList &L1,int n)
{
    if(n < 1 || n > L1.length)  
    {
        printf("编号不存在!\n");
        return 0;
    }
    MailList *p;
    int i;
    p = &(L1.elem[0]);
    for(i = 1;i < n;i ++)
        p += 1;
    int s = 1;
    while(s != 0){
        printf("请选择你要修改的信息:\n1.姓名\n2.电话1\n3.电话2\n4.电子邮箱\n0.退出\n");
        scanf("%d",&s);
        printf("修改为:");
        switch(s)
        {
            case 1:
                char nm[20];
                scanf("%s",nm);
                strcpy(p->name , nm);
                printf("修改成功!\n");
                break;
            case 2:
                char t1[12];
                scanf("%s",t1);
                strcpy(p->tel1 , t1);
                printf("修改成功!\n");
                break;
            case 3:
                char t2[12];
                scanf("%s",t2);
                strcpy(p->tel2 , t2);
                printf("修改成功!\n");
                break;
            case 4:
                char em[50];
                scanf("%s",em);
                strcpy(p->email , em);
                printf("修改成功!\n");
                break;
            case 0:
                return 1;
            default:
                printf("请输入正确的数字!\n");
        }
    }
} 


6个回答

     case 4:
            char em[50];
            scanf("%s",em);
            strcpy(p->email , em);
            printf("修改成功!\n");
            break;
        case 0:
            return 1;
        default:
            printf("请输入正确的数字!\n");
    }
ONEPIECE_LIBING
ONEPIECE_LIBING 有C币吗?
大约一年之前 回复
weixin_42444828
-楊楊楊楊楊 NB
一年多之前 回复
mapplefei
疯狂的maple 好强
一年多之前 回复
weixin_42391364
weixin_42391364 好多
一年多之前 回复
a809586929
a809586929 混个C币
一年多之前 回复
sinat_23081355
sinat_23081355 调试一下吧
一年多之前 回复
qq_40212305
qq_40212305 ???,显示啥错误
一年多之前 回复
weixin_41544662
Zyy_record 看你那软件提示哪里错了,再仔细看看哪里错了吧
一年多之前 回复
Junjun0501
刘双军 引用头函数的方法错了,无法引用 #include"test3_Seq.h" #include"test3_Link.h",命名方式错误
一年多之前 回复
u011374355
沉迷学习陈同学 啥?
一年多之前 回复

modify test_Seq.h

65行:int find_int(SqList &L,int x) 修改为 bool find_int(SqList &L,int x)

100行:int ChangeList(SqList &L1,int n) 修改为 bool ChangeList(SqList &L1,int n)

修改这两处,程序可以成功运行,

但是,我不知道你的问题是不是程序编译方面的问题,毕竟你没说 图片说明orz

case 4:
char em[50];
scanf("%s",em);
strcpy(p->email , em);
printf("修改成功!\n");
break;
case 0:

修改 test3.cpp的函数声明:
bool find_int(SqList &L, int x);----->int find_int(SqList &L, int x);
bool recoverList(LinkList &L2, int n, MailList &e);------>int recoverList(LinkList &L2, int n, MailList &e);
bool ChangeList(SqList &L1, int n);-------->int ChangeList(SqList &L1, int n);
VS2013 编译通过,可以正常运行!

引用头函数的方法错了,无法引用 #include"test3_Seq.h" #include"test3_Link.h",命名方式错误

代码量好大呀,我一点都不想看下来。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
代码哪里错了?找不出来啊
代码1:rn[code=c]#include rn#include rnrnULONG i = 0;rnvoid FindFile(char * pFilePath)rnrn WIN32_FIND_DATA FindFileData;rn char Dir[MAX_PATH];rn strcat (strcpy (Dir, pFilePath), "\\*");rn HANDLE hFind = FindFirstFile(Dir, &FindFileData);rn if (hFind == INVALID_HANDLE_VALUE) return;rn dorn rn if (!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) //找到文件rn rn strcat(strcat(strcpy(Dir, pFilePath), "\\"), FindFileData.cFileName);rn printf ("%-73s%lu \n",Dir,++i);rn rn else if(FindFileData.cFileName[0]!='.') //找到目录rn rn strcat(strcat(strcpy(Dir, pFilePath), "\\"), FindFileData.cFileName);rn FindFile(Dir);rn rn rn while (FindNextFile(hFind, &FindFileData));rnrnrnint main()rnrn FindFile("i:");rn[/code]rnrn代码2:rn[code=c]#include rn#include rnrnULONG i = 0;rnvoid FindFile(char * pFilePath)rnrn WIN32_FIND_DATA FindFileData;rn char Dir[MAX_PATH];rn strcat (strcpy (Dir, pFilePath), "\\*");rn HANDLE hFind = FindFirstFile(Dir, &FindFileData);rn if (hFind == INVALID_HANDLE_VALUE) return;rn dorn rn strcat(strcat(strcpy(Dir, pFilePath), "\\"), FindFileData.cFileName);rn if (!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) //找到文件rn rn printf ("%-73s%lu \n",Dir,++i);rn rn else if(FindFileData.cFileName[0]!='.') //找到目录rn rn FindFile(Dir);rn rn rn while (FindNextFile(hFind, &FindFileData));rnrnrnint main()rnrn FindFile("i:");rnrnrn[/code]rnrn[size=16px][b]代码一在遍历i盘下所有文件的时候正常显示,rn 修改成代码二,运行后遍历到一半的时候,程序就崩溃了,请问哪里出了问题了,我只是改变了下顺序吧 代码二实在看不出来和代码一有啥明显的差异啊。[/b][/size]rnrn另外代码一虽然程序不崩溃,可有些时候遍历的文件数目怎么跟实际数目不符啊,特别是一些保存的网页文件,是因为编码吗?rnrn[img=https://img-bbs.csdn.net/upload/201804/24/1524542180_137971.png][/img]rn
这个c程序哪里错了????
为什么总是不能运行,但又没有提示错误???我是新手,刚开始自学,谢谢![图片说明](https://img-ask.csdn.net/upload/201507/06/1436145383_305188.png)
这个c程序哪里错了?????
#includenint main(void)nn const int danjia = 5;n int shuliang = 0;n int zongjia = 0;n int zan = 0;n printf("shurushuliang:");n scanf("%d",&shuliang);n zan = shuliang * danjia;n n if((zan > 30) && (zan <= 50))n zongjia = shuliang*danjia*0.1;n printf("%d",zongjia);n if(zan > 50)n zongjia = shuliang*danjia*0.15;n printf("%d",zongjia);n elsen printf("%d",shuliang*danjia):n return 0:nn nnnn就是提示出错,但我就是找不到哪里错了。。。。。
这个C程序哪里错了?
#includernrnvoid main()rnrn double profit,prize,a,b,c,d,e,f,sum; //profit表示利润,prize表示奖金,单位是万。rn printf("\n请输入利润:");rn scanf("%f",&profit);rnrn switch(profit)rn rn case(profit<=10):rn a=profit*0.1;rn printf("\n10万元内的奖金为:%f",a);rn break;rn case(profit>10&&profit<20):rn b=(profit-10)*0.075;rn printf("\n高于10万元部分的奖金为:%f",b);rn break;rn case(profit>20&&profit<40):rn c=(profit-20)*0.05;rn printf("\n高于20万元部分的奖金为:%f",c);rn break;rn case(profit>40&&profit<60):rn d=(profit-40)*0.03;rn printf("\n高于40万元部分的奖金:%f",d);rn break;rn case(profit>60&&profit<100):rn e=(profit-60)*0.1.5;rn printf("\n高于60万元部分的奖金:%f",e);rn break;rn case(profit>100):rn f=(profit-100)*0.01;rn printf("\n高于100万元部分的奖金:%f",f);rn break;rn default:rn printf("\n无法计算\n");rn rn sum=a+b+c+d+e+f;rn printf("\n发放奖金的总和是:%f",sum);rn
找不出哪里出错了,可是就是没有反应
rn rnrnrnrnrnrnrnrnrn在点击EditCommandColumn的“编辑”按钮后,应该对应行都变成editbox形式,并且“编辑”按钮将变成“更新”和“取消”两个按钮阿,可是就是没反应。rn这是为什么啊?rn
看看哪里错了????实在找不出错误了
实现一个串的赋值问题的rnrn#include rn#include"struct.h" rnusing namespace std; rnextern int strassign(hstring &t,char *chars);rnint main() rn rn hstring s,t;rn if(strassign(s,"sowkdjdls"))rn cout<
insert into 语法错误 找不出哪里错了 帮忙啊!!!
public void Button_Click(object Source,EventArgs e)rn rn string exce="insert into jzgjbxx(Time,Name) values('"+Time.Text.ToString()+"','"+Name.Text.ToString()+"')";rnrn if ((Time.Text=="")||(NO.Text==""))rn rn Label1.Text="日期和编号不能为空";rn rn else if (Name.Text=="")rn Label1.Text="名字不能为空";rn elsern rn Label1.Text="正常提交";rn OleDbConnection myConnection = new OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0;Data Source = "+Server.MapPath("Database\\hrm.mdb"));rn OleDbCommand myCommand = new OleDbCommand(exce,myConnection);rn myCommand.Connection.Open();rn myCommand.ExecuteNonQuery();rn myCommand.Connection.Close();rn Response.Redirect("WebForm1.aspx");rn rn rnrnTime,Name 都是文本 这样怎么提示 insert into 语法错误 是哪里错了啊
C语言程序代码错误,找不出哪里错了(小白求解)
#includeint main( )char sex,sports,diet;double faHeight,moHeight,a,b,myHeight,Height1,Height2;a=0.54;b= 0.923;printf("输入你的性别\n");scanf("%c",&sex);printf("是否喜爱体育锻炼\n"); scanf("%c",&sports);printf("是否有良好的饮食习惯\n"); scanf("%c",&diet);if(sex=='F')//判断性别的if; if(sports=='Y')// 判断运动情况的if; Height1=(((faHeight*a+moHeight)/2)*0.02);//爱运动的增长 elseHeight1=0;//不爱运动 if(diet=='Y')//判断饮食习惯的if; Height2=(((faHeight*a+moHeight)/2)*0.015);//有好的饮食习惯的增长 elseHeight2=0; //没有好的饮食习惯 myHeight=(faHeight+moHeight)*0.54+Height2+Height1;else( if(sports=='Y') Height1=(((faHeight+moHeight)*0.54)*0.02);//爱运动的增长 elseHeight1=0;//不爱运动 if(diet=='Y')//判断饮食习惯的if; Height2=(((faHeight+moHeight)*0.54)*0.015);//有好的饮食习惯的增长 elseHeight2=0; //没有好的饮食习惯 myHeight=(faHeight*0.923+moHeight)/2+Height2+Height1; printf("%f",myHeight); myHeight=(faHeight*0.923+moHeight)/2+Height2+Height1;printf("%f",myHeight);return 0;![图片](https://img-ask.csdn.net/upload/201610/24/1477318323_210399.jpg)
c程序求∑(n=1,20)n!c程序求∑(n=1,20)n!我的程序哪里错了
c程序求∑(n=1,20)n!c程序求∑(n=1,20)n!我的程序哪里错了rn答案是rnmain()rnfloat s=0,t=1;rn int n;rn for(n=1;n<=20;n++)rn t*=n;rn s+=t;rn rn printf("%e\n",s);rn rn结果:2.561327e+18rn我的第一个程序是:(我是倒着从20!开始算得count表计数,从1到20)rnmain()rn int n=20,i;rn float t=1,s=0,count=0;rn i=n;rn while(count<=20)rn rn for(;i>=1;i--)rn t*=i;rn count++;rn i=n-count;rn s=s+t;rn rn printf("%f\n",s);rnrn显示:FLOATING POINT ERROR:OVERFLOW,我换了改求∑(n=1,3)n!,发现也是显示结果大于应该的答案。rn第二个程序:(和我的程序1思路相似)rnmain()rn int n=20,i=20;rn float t=1,s=0,count=0;rn for(;count<20&&i>=1;count++)rn t*=i;rn i--;rn i=n-count;rn s+=t;rn printf("%e\n",s);rn运行结果为0rn第三个程序:(与第二个程序的区别是一个的i--在for(;;)内,我不知道应该怎么样正确)rnmain()rn int n=20,i=20;rn float t=1,s=0,count=0;rn for(;count<20&&i>=1;count++,i--)rn t*=i;rn i=n-count;rn s+=t;rn printf("%e\n",s);rnZrn结果为6.6131e+18rn可是我的程序的结果各不相同,均不同于标准答案,请问为什么rn谢谢
真找不出那里错了,晕,帮我看看吧!
string strSql = "select email from ticket_customer where customer_id = @customerId and password = @pwd";rnrnSqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["ConString"]);rn SqlCommand cmd = new SqlCommand(strSql,con);rnrn cmd.Parameters.Add(new SqlParameter("@customerId",SqlDbType.VarChar,50));rn cmd.Parameters.Add(new SqlParameter("@pwd",SqlDbType.VarChar,50));rn cmd.Parameters["@customerId"].Value = customerId;rn cmd.Parameters["@pwd"].Value = passWord;rnrn con.Open();rnrn SqlDataReader dr = cmd.ExecuteReader();rnrn两个参数都付了值,但cmd.CommandText 始终等于rn"select email from ticket_customer where customer_id = @customerId and password = @pwd"rnrn也就是说@customerId和@pwd没有获取到相应的值,为什么?
C语言求最大值,哪里错了。急
[img=https://img-bbs.csdn.net/upload/201905/02/1556796306_486237.png][/img]rn[face]onion:1.gif[/face]
哪里错了,求大神!!!!
#includennvoid input(char*s)nnscanf("%s",s);nnvoid output(char*s)nnprintf("%s",s);nnvoid add(char*s1,char*s2,char*s)nnint i,j,k,k1,t=0;nn for(i=0;s1[i];i++);nn for(j=0;s2[j];j++);nn i--,j--;nn k=i>j?i:j;nn k1=k+1;nn s[k1]='\0';nn for(;i>=0&&j>=0;k--)nn nns[k]=s1[i--]+s2[j--]-'0'+t;nnt=s[k]>'9';nnif(t)s[k]-=10;nn nn for(;i>=0;k--)nn nns[k]=s1[i--]+t;nnt=s[k]>'9';nnif(t)s[k]-=10;nn nn for(;j>=0;k--)nn nns[k]=s2[j--]+t;nnt=s[k]>'9';nnif(t)s[k]-=10;nn nn if(t)nn nnfor(;k1>=0;k1--)s[k1+1]=s[k1];nns[0]='1';nn nnnnnnnvoid sub(char*s1,char*s2,char*s)nnint i,j,k,k1,t=0;nn for(i=0;s1[i];i++);nn for(j=0;s2[j];j++);nn i--,j--;nn k=i>j?i:j;nn k1=k+1;nn s[k1]='\0';nn for(;j>=0;k--)nn nns[k]=s1[i--]-s2[j--]+'0'-t;nnt=s[k]<'0';nnif(t)s[k]+=10;nn nn for(;i>=0;k--)nn nns[k]=s1[i--]-t;nnt=s[k]<'0';nnif(t)s[k]+=10;nn nnnnint comp(char*s1,char*s2)nnint i,j;nn for(i=0;s1[i];i++);nn for(j=0;s2[j];j++);nn if(i>j)return 1;nn if(i=0&&s1[i]==s2[i];i++);nn if(s1[i]>s2[i])return 1;nn if(s1[i]
c初学者。这个程序到底哪里错了?
题目:rnDescriptionrn给出一个8*8的01矩阵,请判断出由数字1所填充的图形(三角形/梯形/椭圆形/矩形)。rnrnInputrn第一行输入N,表示有N组测试数据 接下来八行为矩阵内容,每两个数字中间用一个空格隔开 每两个矩阵中间有一个空行rnrnOutputrn输出判断出的形状,每个占一行(三角形输出"triangle",梯形输出"trapezia",椭圆输出"ellipse",矩形输出"rectangle") 你可以在纸上画个图形看看,每种图都是有不同的特点。如 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0是椭圆 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 是梯形 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 1 1 1 1 1 0 0 0 0 1 1 1 0 0 0rnrnrnSample Inputrnrn2rn0 0 0 0 0 0 0 0rn0 0 1 1 1 1 1 0rn0 0 1 1 1 1 1 0rn0 0 1 1 1 1 1 0rn0 0 1 1 1 1 1 0rn0 0 0 0 0 0 0 0rn0 0 0 0 0 0 0 0rn0 0 0 0 0 0 0 0rnrn0 0 0 0 0 0 0 0rn0 0 1 1 1 1 1 0rn0 0 1 1 1 1 0 0rn0 0 1 1 1 0 0 0rn0 0 1 1 0 0 0 0rn0 0 1 0 0 0 0 0rn0 0 0 0 0 0 0 0rn0 0 0 0 0 0 0 0rnrnSample OutputrnrnrectanglerntrianglernHint梯形的底一定处于水平线上,不会出现特殊情况rnrnrnrnrnrn我的代码:rn#includernint main()rnrn char a[8][15];rn int i,j,t;rn int r[8],c[15],s1=0,s2=0,flag=0,n,max,maxi;rn scanf("%d",&n);rn getchar();rn for(t=0;tmax)rn rn max=r[i];rn maxi=i;rn rn rn for(i=0;i<15;i++)rn rn if(r[i]==1)rn s1++;rn if(c[i]==1)rn s2++;rn rn if(s1==1&&max!=1)rn rn flag=1;rn printf("triangle\n");rn continue;rn rn if(s2==2&&r[maxi+1]!=r[maxi-1]&&r[maxi]!=r[maxi+1])rn rn flag=1;rn printf("trapezia\n");rn continue;rn rnrnrn for(i=0;i<7;i++)rn rn if(r[i]!=0)rn rn if(r[i]==r[i+1]||r[i+1]==0)rn rn flag=1;rn printf("rectangle\n");rn break;rn rn else rn break;rn rn rn if(flag==1)rn continue;rn printf("ellipse\n");rn rn return 0;rnrnrnrn被wrong的受不了了。
51单片机矩阵键盘 STC90C516RD+ C程序哪里错了???
#includern#define key P1rnvoid delay(unsigned int c);rnint lie,hang,num,a;rnunsigned char code n[17]=rn0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,rn0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71;rnsbit LEA=P2^2;rnsbit LEB=P2^3; rnsbit LEC=P2^4;rnvoid main()rnLEA=0;rnLEB=0;rnLEC=0; rnwhile(1)rnrn key=0x0f;rnif(key!=0xf0)rnrn delay(1);rn if(key!=0xf0)rn rn switch(key)rn rn case(0xe0):lie=1;break;rn case(0xd0):lie=2;break;rn case(0xb0):lie=3;break;rn case(0x70):lie=4;break;rn default:lie=0;rn rn key=0x0f;rn if(key!=0x0f)rn rn delay(1);rn if(key!=0x0f)rnrn switch(key)rncase(0x0e):hang=1;break;rn case(0x0d):hang=2;break;rn case(0x0b):hang=3;break;rn case(0x07):hang=4;break;rn default:hang=0;rn rn rnrnif(lie==1)rn switch(hang)rn case(1):num=0;break;rn case(2):num=4;break;rn case(3):num=8;break;rn case(4):num=12;break;rn default:num=17;rn rn else if(lie==2)rn switch(hang)rn rn case(1):num=1;break;rn case(2):num=5;break;rn case(3):num=9;break;rn case(4):num=13;break;rn default:num=17;rn rn else if(lie==3)rn switch(hang)rn case(1):num=2;break;rn case(2):num=6;break;rn case(3):num=10;break;rn case(4):num=14;break;rn default:num=17;rn rn else if(lie==4)rn switch(hang)rn case(1):num=3;break;rn case(2):num=7;break;rn case(3):num=11;break;rn case(4):num=15;break;rn default:num=17;rn rn else rn num=17;rn P0=n[num];rnrn while((a<50)&&(key!=0x0f)) //按键松手检测rn rn delay(1);rn a++;rn rn a=0;rnrnrnrnrnvoid delay(unsigned int c)rnrn unsigned char a, b;rn for (;c>0;c--)rn rn for (b=38;b>0;b--)rn rn for (a=130;a>0;a--);rn rn rn
简单的几行C程序,哪里错了?
main()rn int i;rn scanf("%d",&i);rn int n=0;rn if(i>n)rn printf(">");rn elsern printf("<=");rnrnrn哪里错了?为什么会出现这种错误?
求n得阶乘的程序,哪里错了
import java.io.*;rnclass jiecheng rnrn public static void main(String[] args) rn rn int n,sum;rn rn tryrn rn System.out.println("输入n:");rn n=(int)System.in.read();rn //n=System.in.read();rn rn catch (IOException e)rn rn rnrn sum=funtion(n);rn System.out.println("The sum is:"+sum);rnrn int funtion(int a)rn rn if (a==1) return 1;rn return a*funtion(a-1);rn rnrn rn
这程序哪里错了?
以下的程序哪里错了?这是我学汇编以来的写的第二个程序,不知道哪里错了,郁闷了一个下午,连课也听不进。哪位帮改一下啊?帮改成能编译通过并能运行的,并且说一下有没有固定的格式的?就像C语言里有main函数的固定格式一样rnrn.386rn.datarnval1 sdword 1rnval2 sdword ?rnmov eax val1rnmov val2 eaxrnrn编译错误代码为:rn Assembling: E:\masm32\myfile\2.asmrnE:\masm32\myfile\2.asm(3) : error A2013: .MODEL must precede this directivernE:\masm32\myfile\2.asm(4) : error A2034: must be in segment blockrnE:\masm32\myfile\2.asm(5) : error A2034: must be in segment blockrnE:\masm32\myfile\2.asm(6) : error A2008: syntax error : in instructionrnE:\masm32\myfile\2.asm(7) : error A2008: syntax error : in instructionrnE:\masm32\myfile\2.asm(7) : error A2088: END directive required at end of filern 驱动器 E 中的卷是 软件rn 卷的序列号是 D803-AE24rnrn E:\masm32\myfile 的目录rnrn2010-03-31 19:23 73 2.asmrn 1 个文件 73 字节rn 0 个目录 163,715,723,264 可用字节rn
简单的程序,哪里错了
class Hello rn public static void main(String[] args) rn String a="x",b="x";rn int comapre(String c,String d)rn rn int i=0;rn if(c.equals(d)) i++;rn return i;rn rn System.out.print( comapre(a,b));rn rn
这个程序哪里错了,求指点
题目:编程找出5个整数中的最大数和最小数,并输出找到的最大数和最小数。rn代码如下:rn#includernint main()rnrn int u,v,w,x,y,z;rn printf("请输入第一个整数:");rn scanf("%d",v);rn getchar();rn printf("请输入第二个整数:");rn scanf("%d",w);rn if(w<=v)rn rn u=v;rn v=w;rn w=u;rn u=0;rn rn printf("请输入第三个整数:");rn scanf("%d",x);rn if(x<=v)rn rn u=v;rn v=x;rn x=w;rn w=u;rn u=0;rn rn else if(v<=x&&x<=w)rn rn u=w;rn w=x;rn x=u;rn u=0;rn rn printf("请输入第四个整数:");rn scanf("%d",y);rn if(v>=y)rn rn u=v;rn v=y;rn y=u;rn u=w;rn w=y;rn y=u;rn u=x;rn x=y;rn y=u;rn u=0;rn rn else if(v<=y&&y<=w)rn rn u=w;rn w=y;rn y=u;rn u=x;rn x=y;rn y=u;rn u=0;rn rn else if(w<=y&&y<=x)rn rn u=x;rn x=y;rn y=u;rn u=0;rn rn printf("请输入第五个整数:");rn scanf("%d",&z);rn if(z<=v)rn rn u=v;rn v=z;rn z=u;rn u=w;rn w=z;rn z=u;rn u=x;rn x=z;rn z=x;rn u=y;rn y=z;rn z=u;rn u=0;rn rn else if(v<=z&&z<=w)rn rn u=w;rn w=z;rn z=u;rn u=x;rn x=z;rn z=u;rn u=y;rn y=z;rn z=u;rn u=0;rn rn else if(w<=z&&z<=x)rn rn u=x;rn x=z;rn z=u;rn u=y;rn y=z;rn z=u;rn u=0;rn rn else if(x<=z&&z<=y);rn rn u=y;rn y=z;rn z=u;rn u=0;rn rn printf("五个整数为%d,%d,%d,%d,%d。",v,w,x,y,z);rn printf("最大数为%d,最小数为%d。",z,v);rn return 0;rn
请问这个求矩阵乘法的程序哪里错了?
#include nint main(void)nn int ar1[2][2] = 2,0,1,0 ;n int ar2[2][2] = 1,2 ,0,0 ;n int ar3[2][2];n int i;n int j;n int c=2;n int k;n for (i = 0; i < 2; i++)n for (j = 0; j < 2; j++)n for (k = 0; k < c; k++)n ar3[i][j] += ar1[i][k] * ar2[k][j];n for (i = 0; i < 2; i++)n n for (j = 0; j < 2; j++)n n printf("%d\t", ar3[i][j]);n n printf("\n");n nn return 0;nnn
请问:这个求平均数的程序哪里错了??
#include "stdio.h"rnrnint main()rnint str[1000],s=0,n,i,x;rn printf("请输入输入数的个数n\n");rn scanf("%d",&n); rn printf("请输入n个数\n");rn for(i=0;i
求解下面的程序哪里错了——新手
#includern/*当fahr=0.20...200时,打印华氏与摄氏温度的对照表*/rnmain()rnrn int fahr, celsius;rn int lower,upper,step;rnrn lower=0;rn upper=200;rn step=20;rnrn fahr=lower;rn while(fahr<=upper) rn celsius=5*(fahr-32)/9;rn printf("%d\t%d\n",fahr,celsius);rn fahr=fahr+step;rn rnrn rn
这个程序哪里错了?
#include rn#include rnvoid main()rnrn int stoi(char *str);rn int n;rn char str[15]=0;rn printf("请输入一个字符串: ");rn scanf("%s", &str);rn stoi(str);rn printf("%d\n", n);rnrnint stoi(char *str)rnrn int n;rn n=atoi(str);rn return n;rnrnrnrnrn编译没错,但输入后回车,出来了-858993460,应该是输入字符串数字,输出整型的才对
简单的程序 哪里错了
[code=C/C++]rnmain()rnrn char *s="hehe";rn char *p="sdff";rn while(*s++=*p++)rn printf("%s",s);rnrn[/code]rnrn请帮忙看下
这个程序哪里错了????
#includern#includern#includernusing namespace std;rnclass Arnrnprivate:rn char name[5],sex[2];rn int age;rnpublic:rn A(char *n,int a,char *s)rn rn strcpy(name,n);rn age=a;rn strcpy(sex,s);rn rn;rn int main()rnrn A a1("章",22,"m");rn A a2("网",23,"w");rn A a3("丽",25,"m");rn vector i;rn i.push_back(a1);rn i.insert(i.begin(),a2);rn i.push_back(a3);rn vector::iterator ii;rn for(ii=i.begin();ii!=i.end();ii++)rn cout<name<
想知道自己哪里错了(初学者)
#include rn#include rnusing namespace std;rnrnbool 回文数( int n ) ;rnvoid main( void )rnrn int x ;rn cout<<" x x*x x*x*x"<rn#include rnusing namespace std;rnrnbool 回文数( int n ) ;rnvoid main( void )rnrn int x ;rn cout<<" x x*x x*x*x"<
程序哪里错了
$(foreach VAR,$(BRIEF),$(eval $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))rn$(foreach VAR,$(SILENT),$(eval $(VAR) = @$($(VAR))))rn$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))rn 说是第一句话foreach缺少一个右括号rnrn../common.mak:28: *** unterminated call to function `foreach': missing `)'. Stop.
以下程序哪里错了
rnrn#include rn#include rnusing namespace std;rnrntemplate rnint count(Type *s,int sz,const Type &which)rnrn int n=0;rn for(int i=0;i
以下程序错了哪里???
<% @language="vbsript"%>rn<% option explictrndim int - agerndim str name,str - inforndim int - num(2,4)%>
这个程序哪里错了?
#include "stdafx.h"rnusing namespace std;rnrntemplaternT Max(T a,T b)return a>=b?a:b;rntemplaternT *Max(T *a,T *b)return *a>=*b? a:b;rntemplate<>rnchar *Max(char *a,char *b)rnreturn strcmp(a,b)>=0?a:b;rnrnrn//char *Max(char *a,char *b)return strcmp(a,b)>=0?a:b;rnrnvoid main()rndouble d3=3.3,d5=5.5;rncout<
程序哪里错了?
我有一道程序题rnimport java.awt.*;rnrnpublic class StudyFrame extends Framern StudyFrame()rn Frame fr=mew Frame;rn Button bt=new Button("确定");rn TextArea ta=new TextArea(10,30);rn fr.setTitle("yingyong");rn fr.setSize(300,200);rn fr.add(bt);rn fr.add(ta);rn fr.show();rn rn public static void main(String args[])rn rn new StudyFrame();rn rnrn 运行时候出不来老是说异常,请各位高手指教
这个程序哪里错了
#include "stdio.h"rnvoid main()rnrn int j,i,k;rn for(j=1;i<=19;i++)rn if i<=11rn for(j=1;j<=11-i;j++rn printf(" ");rn for(k=1;k=2*i+1;k++)rn printf("*");rn printf("/n");rnelsernfor(j=1;j=i-9;j++)rnprintf(" ");rnfor(k=1;k<=(19-i)*2+1;k++)rnprintf("*");rnprintf("/n");rnrnrn
这段程序哪里错了?
import java.awt.event.*;rnimport java.awt.*;rnpublic class wwrnrn public static void main(String[] args) rn rn Button b = new Button("Press Me!");rn b.addActionListener(new ButtonHandler());rn b.setVisible(true);rn rn rnrnrnclass ButtonHandler extends ActionListenerrnrn public void PerFormed(ActionEven e)rn rn System.out.println("Action occurred");rn rn
看看程序哪里错了
求助下 帮我看看程序哪里错了rn[code=C/C++][/code]rn#includernusing namespace std;rnclass dogrnrnpublic:rnvoid set(int g,double w);rndog(int g=0,double w=5);rn~dog();rnint getage()rnrn return age;rnrndouble getweight()rnrn return weight;rnrnrnrnprivate:rn int age;rn double weight;rn;rnrndog::dog(int g,double w)rn age=g;rnweight=w;rnrnrnrnrndog::~dog()rnrnrnrnrnrnint main()rnrn dog jack(2,10);rn cout<<"jack is a dog who is ";rn cout<
J2ME程序,哪里错了?
代码:rn[code=Java]rnpackage wen.hui;rnrnimport javax.microedition.midlet.*;rnimport javax.microedition.lcdui.*;rnrnpublic class Test extends MIDlet rnrn private TextBox textBox = new TextBox("Test", "TextBox and Ticker", 1024, TextField.ANY);rn private Display display = null;rn public void startApp()rn if(display==null)rn Ticker ticker = new Ticker("wellcome to J2ME");rn textBox.setTicker(ticker);rn display = Display.getDisplay(this);rn display.setCurrent(textBox);rn else rn display.setCurrent(textBox);rn rn rnrn public void pauseApp()rnrn rnrn public void destroyApp(boolean unconditional)rnrn rnrn[/code]rnrn我用的是NetBeans6.7rn为什么运行后在模拟手机上什么也没有,rn我是照书上做的。。。。rn新手,麻烦帮帮忙
这道程序哪里错了?
[code=C/C++]#include rnusing namespace std;rnrnstruct Tryrnrn double one;rn int two;rn;rnint main()rnrn Try temp[5];rn temp[0] = 54.24, 62;rn temp[1] = 65.72, 22;rn temp[2] = 67.46, 58;rn temp[3] = 97.86, 42;rn temp[4] = 35.27, 53;rnrn for(int i=0;i<5;i++)rn cout << temp[i].one << "\t" << temp[i].two << endl;rnrn return 0;rn[/code]rnrn请大家帮我看一下这道程序错在哪了,应该怎么改,先谢谢了。rn平时用C++的class太多,倒忘记结构体怎么用了,唉。
程序查错
貌似我输出的结果太多了,怀疑自己写错了,请各位帮忙看下rnrn题目:rn任意一个5位数,比如:34256,把它的各位数字打乱,重新排列,可以得到一个最大的数:65432,一个最小的数23456。求这两个数字的差,得:41976,把这个数字再次重复上述过程(如果不足5位,则前边补0)。如此往复,数字会落入某个循环圈(称为数字黑洞)。rn比如,刚才的数字会落入:[82962, 75933, 63954, 61974] 这个循环圈。rnrn请编写程序,找到5位数所有可能的循环圈,并输出,每个循环圈占1行。其中5位数全都相同则循环圈为 [0],这个可以不考虑。循环圈的输出格式仿照:rn[82962, 75933, 63954, 61974]rn其中数字的先后顺序可以不考虑。rnrnrn我写的rn[code=Java]import java.util.Arrays;rnimport java.util.ArrayList;rnpublic class test4rn static ArrayList al=new ArrayList();rn static int num=10000;rn public static void main(String[] args)rn for(;num<100000;num++)rn check(num);rn rn rn public static void check(int n)rn String tempstr=String.valueOf(n);rn int[] tempint=new int[tempstr.length()];rn for(int i=0;i
求大神解答实在找不出毛病在哪里
#define __STDC_WANT_LIB_EXT1__ 1//说明:出入数字,输出对应英文rn#includern#includern#includern#includernint main(void)rnrn char again='Y';rn dorn rn int num;//数字rn char result[100] = "";//结果rn size_t result_len = sizeof(result);rn char connect1[10] = " hundred";//连接1rn char connect2[10] = " and ";//连接2rn char a[10][7] = rn " ","One","Two","Three","Four","Five","Six ","Seven ","Eight ","Nine "//百位rn ;rn char b[10][8] = rn " "," ","twenty ","thirty ","forty ","fifty ","sixty ","seventy ","eighty ","ninty "//十位rn ;rn char c[10][7] = rn " ","one","two","three","four","five","six ","seven ","eight ","nine "//个位rn ;rnrn while (true)//检查输入是否在0-1000rn rn printf("\nEnter a number less than 1000.\n");rn scanf("%d", &num);rn if ((num < 0) || (num>999))rn printf("You are kidding.Enter again.");rn elsern break;rn rn //形成最终结果rn int g = num / 100;rn num = num - g * 100;rnrn if (strcat_s(result, result_len, a[g]))rn rn printf("Error");rn return 1;rn rn if (a[g][0] != ' ')rn strcat_s(result, result_len, connect1);rn if ((num > 0) && (g != 0))rn strcat_s(result, result_len, connect2);rn g = num / 10;rn if (strcat_s(result, result_len, b[g]))rn rn printf("Error");rn return 2;rn rn num = num - g * 10;rn g = num;rn if (strcat_s(result, result_len, c[g]))rn rn printf("Error");rn return 3;rn rn printf("%s", result);//输出结果rn printf("\nDo you want to try again? Y or N\n");//判断是否重复操作rn scanf("%c", &again);rn while (toupper(again) =='Y');rn getch();rn return 0;rnrn
相关热词 c++和c#哪个就业率高 c# 批量动态创建控件 c# 模块和程序集的区别 c# gmap 截图 c# 验证码图片生成类 c# 再次尝试 连接失败 c#开发编写规范 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数

相似问题

4
C# 64位程序调用第三方32位dll,请给出方案
3
Linux C++程序运行的问题
1
c和汇编混编中,c中输入一个字符串,调用汇编子程序,为什么比较结果一直是未找到?
2
调试vs2015时某一行调试时间过长,如果不终止,就一直调试中。。
1
5道程序题,请各位大佬帮帮忙
3
同类型为什么要强制转换(自己强转成自己)/ASP.NET Web程序重复引用(引用来自同一文件)问题(已解决)?
3
在使用SQLAlchemy调用mysql数据库时报错
2
C语言,新人求助,为什么我这个程序选择修改的时候不能一对一修改,一改就把以前的全修改没了!
1
用Python 从Mysql中提取数据并将查询结果写进excel,但返回值不是SQL查询值 而是‘0’求高手指教
1
c语言实现电话查询设计
0
Azure function C# 如何监视Connection Pool的连接状态
3
关于c++大数的long long类型的中间计算问题,求大佬解,谢谢!!
1
QT 使用子函数,进行mysql进行查询,返回一个类数组。
1
设置环境变量 设置之后还是不可以
1
C# 使用Mysql.Data 构造参数化查询,设置出参被设置为NULL报错
2
C#插入mysql显示插入成功,但无法查询到数据
3
请教VB button的单击事件问题
1
python 使用with con:连接数据库时 报错AttributeError: __enter__怎么解决呢?
0
计算少需要几次CD操作才能将当前目录变成目标目录,采用C程序语言的算法的实现
2
win10安装Visual Studio 2015后启动主程序闪退