- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在运行程序时遇到 C 语言问题消息“x.exe 已停止工作”。例如 x 是文件的名称。我该如何修复它?
enter code here
#include <stdio.h>
#include <stdlib.h>
struct student
{
int id;
char *firs_name;
char *last_name;
char *email;
};
struct datetime
{
int date;
int time;
};
typedef struct student student;
typedef struct datetime datetime;
struct submission
{
student *stud1;
student *stud2;
datetime *dt;
};
typedef struct submission submission;
int details(submission *data, int n1, datetime due_date, int *lates);
submission *return_clear_arr(submission *data,int n1);
submission *return_clear_arr(submission *data,int n1)
{
int i,j;
for(i=0;i<n1;i++)
{
for(j=1;j<n1;j++)
{
if(data[i].stud1->id==data[j].stud1->id && data[i].stud2->id==data [j].stud2->id)
{
data[j].stud1->id=-1;
data[j].stud2->id=-1;
}
if(data[i].stud1->id==data[j].stud1->id)
{
data[j].stud1->id=-1;
}
if(data[i].stud1->id==data[j].stud2->id)
{
data[j].stud2->id=-1;
}
if(data[i].stud2->id==data[j].stud1->id)
{
data[j].stud1->id=-1;
}
if(data[i].stud2->id==data[j].stud2->id)
{
data[j].stud2->id =-1;
}
else
{
continue;
}
}
}
return data;
}
int details(submission *data, int n1, datetime due_date, int *lates)
{
int i,counter=0,counter1=0;
submission *data2;
data2=return_clear_arr(data,n1);
for(i=0;i<n1;i++)
{
if(data[i].dt->date < due_date.date)
{
if( data[i].stud1->id==-1 && data[i].stud2->id==-1)
{
continue;
}
if( data[i].stud1->id!=-1 && data[i].stud2->id==-1)
{
counter++;
}
if( data[i].stud1->id==-1 && data[i].stud2->id!=-1)
{
counter++;
}
if( data[i].stud1->id!=-1 && data[i].stud2->id!=-1)
{
counter+=2;
}
}
if(data[i].dt->date > due_date.date)
{
if( data[i].stud1->id==-1 && data[i].stud2->id==-1)
{
continue;
}
if( data[i].stud1->id!=-1 && data[i].stud2->id==-1)
{
counter1++;
}
if( data[i].stud1->id==-1 && data[i].stud2->id!=-1)
{
counter1++;
}
if( data[i].stud1->id!=-1 && data[i].stud2->id!=-1)
{
counter1+=2;
}
}
if(data[i].dt->date == due_date.date && data[i].dt->time < due_date.time)
{
if( data[i].stud1->id==-1 && data[i].stud2->id==-1)
{
continue;
}
if( data[i].stud1->id!=-1 && data[i].stud2->id==-1)
{
counter++;
}
if( data[i].stud1->id==-1 && data[i].stud2->id!=-1)
{
counter++;
}
if( data[i].stud1->id!=-1 && data[i].stud2->id!=-1)
{
counter+=2;
}
}
if(data[i].dt->date == due_date.date && data[i].dt->time > due_date.time)
{
if( data[i].stud1->id==-1 && data[i].stud2->id==-1)
{
continue;
}
if( data[i].stud1->id!=-1 && data[i].stud2->id==-1)
{
counter1++;
}
if( data[i].stud1->id==-1 && data[i].stud2->id!=-1)
{
counter1++;
}
if( data[i].stud1->id!=-1 && data[i].stud2->id!=-1)
{
counter1+=2;
}
}
}
*lates=counter1;
return counter;
}
int main()
{
int n1=6,result1;
int *lates1;
datetime due_date1={14314,1200};
submission data1[6];
submission sub1,sub2,sub3,sub4,sub5,sub6;
sub1.stud1[0].id= 23423446;
sub1.stud1[1].firs_name ="Yoram";
sub1.stud1[2].last_name= "Givon";
sub1.stud1[3].email= "yoram@gmail.com";
sub1.stud2[0].id= 823654434;
sub1.stud2[1].firs_name ="Mor";
sub1.stud2[2].last_name= "Kol";
sub1.stud2[3].email= "mor@gmail.com";
sub1.dt->date=13314;
sub1.dt->time=2000;
data1[0]=sub1;
sub2.stud1[0].id= 423423467;
sub2.stud1[1].firs_name ="Uri";
sub2.stud1[2].last_name= "Kaplan";
sub2.stud1[3].email= "uri@gmail.com";
sub2.stud2[0].id= 834654434;
sub2.stud2[1].firs_name ="Naama";
sub2.stud2[2].last_name= "Vilk";
sub2.stud2[3].email= "naama@gmail.com";
sub2.dt->date=12314;
sub2.dt->time=2000;
data1[1]=sub2;
sub3.stud1[0].id= 482634546;
sub3.stud1[1].firs_name ="Uriel";
sub3.stud1[2].last_name= "Shalom";
sub3.stud1[3].email= "uriel@gmail.com";
sub3.dt->date=14314;
sub3.dt->time=1100;
data1[2]=sub3;
sub4.stud1[0].id= 429283243;
sub4.stud1[1].firs_name ="Omer";
sub4.stud1[2].last_name= "Chen";
sub4.stud1[3].email= "omer@gmail.com";
sub4.stud2[0].id= 423654434;
sub4.stud2[1].firs_name ="Dan";
sub4.stud2[2].last_name= "Lerner";
sub4.stud2[3].email= "dan@gmail.com";
sub4.dt->date=13314;
sub4.dt->time=1000;
data1[3]=sub4;
sub5.stud1[0].id= 492381236;
sub5.stud1[1].firs_name ="Amit";
sub5.stud1[2].last_name= "Paz";
sub5.stud1[3].email= "amit@gmail.com";
sub5.dt->date=13314;
sub5.dt->time=800;
data1[4]=sub5;
sub6.stud1[0].id= 745919897;
sub6.stud1[1].firs_name ="Dikla";
sub6.stud1[2].last_name= "Gefen";
sub6.stud1[3].email= "dikla@gmail.com";
sub6.stud2[0].id= 925962312;
sub6.stud2[1].firs_name="Yaara";
sub6.stud2[2].last_name= "Shaked";
sub6.stud2[3].email= "yaara@gmail.com";
sub6.dt->date=14314;
sub6.dt->time=1159;
data1[5]=sub6;
result1=details(data1,n1,due_date1,lates1);
printf("%d",result1);
return 0;
}
嗨,我在运行程序时遇到一个 C 语言问题消息“x.exe 已停止工作”。例如 x 是文件的名称。我该如何修复它?
最佳答案
您需要花时间学习如何使用 IDE 的调试器以及如何检查代码和收到的任何编译器警告。你的问题出在 main() 中:
在这里,您创建了一堆提交结构实例:
submission sub1,sub2,sub3,sub4,sub5,sub6;
然后,你尝试做这个作业:
sub1.stud1[0].id= 23423446;
如果您查看提交声明:
struct submission
{
student *stud1;
student *stud2;
datetime *dt;
};
您将看到 Stud1 是指向学生的指针,而不是学生。所以没有为该结构分配内存。指针指向垃圾。然后,您尝试取消对指针的引用,并发生错误、段错误。您需要将其初始化为学生类型的有效内存块。这留给你作为学习练习。
关于c - 如果我有这样的c语言消息 ".exe has stopped working"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22443490/
我经常使用stop Fortran 中固有的因各种原因停止执行(主要是在测试失败后)。 program test1 stop end program 除了停止程序执行之外什么都不做。 prog
我想编写一个函数,用字符 e 替换所有出现的字符 c。这些功能似乎正在发挥作用。然而,主要是,我希望能够重复输入一个字符串,扫描要替换的字符,扫描要替换的字符,并打印之前和之后的内容,直到输入的字符串
在 powershell 中,我看到了多种停止服务的方法 更现代的方式 Stop-Service wuauserv 而更传统的方式 NET STOP WUAUSERV 遗留方式 is much mor
所以问题是我需要一个正则表达式,只有当它的 stop 也意味着 stopp 或 sstoooppp 时,它才会匹配第二个单词> 后跟一个空格。我需要得到这个词,我找不到任何正则表达式来做到这一点,因为
我正在做这样的事情 http://jsfiddle.net/8ErSL/2/ 当您将鼠标悬停在任何文本框 (div) 上时,其中会出现一个小图标。 我想阻止图标的淡入淡出效果在我不小心将鼠标悬停在 d
这段代码在 Debug模式下工作得很好,但当不是 Debug模式时它总是抛出运行时异常。 mMediaRecorder.stop(); 根据 Java 文档: Stops recordin
这是我的full code ,这里是my project ,当我在 #onCreate 中使用 MediaRecorder#stop 时,它会引发 java.lang.RuntimeException
我使用 C# 编写了一个库并在 PowerShell 脚本中使用它。 C# 库将大量数据加载到数据库中。我正在使用 Start-Job 来启动该过程,并且我正在监视一个文件是否有错误。 但是,我发现即
我正在尝试编写以下问题的代码: 在 a0, a1, ..., an 处有 n 个酒店,使得 0 dp(k)+(ai-ak)^2) dp(i) = dp(k)+(ai-ak)^2)
我有一个简单的测试,我使用 run_forever 方法运行 Python asyncio 事件循环,然后立即在另一个线程中停止它。但是,事件循环似乎并没有终止。我有以下测试用例: import as
我有以下情况: 专用租赁 m4.large 运行 RHEL6 的 EC2 实例 使用 AWS 控制台手动启动它效果很好 尝试启动它的 Lambda 函数(用 Java 编写)失败,因为实例状态为:已停
我正在使用 Yajsw 将我的应用程序作为守护进程运行。 对于状态调用,我希望看到“正在运行”或“已停止”,但我收到的消息如下所示 SW043305-SRV01:/etc/init.d # ./tes
在 Tomcat 或 TomEE 中,service tomcat start/stop 和 ./catalina.sh run/stop 有什么区别? 他们做的事情完全一样吗? 最佳答案 catal
我正在尝试使用 C++ 和 OpenGL/GLUT 制作一个 Snake 克隆。然而,我一直在编程允许输入 Action 之间的短时间间隔时遇到问题。我已经尝试了一些计时方法,最后我为它创建了一个类(
问题: org.apache.catalina.loader.WebappClassLoader - The web application [/…] appears to have started
我正在尝试以下实验: 我有两个QpushButtons,比如PushA 和PushB。现在 PushA 在 QHBoxLayout 中,PushB 也在它自己的 QHBoxLayout 中。这两个水平
我已经在我的 windows 10 机器上安装了 Docker for Windows。当我尝试从“windows 容器”“切换到 linux 容器”时,出现错误。 Unable to start:
我在我的应用程序中集成了摄像头。当用户单击捕获按钮时,我隐藏了工具栏,以便摄像头预览屏幕尺寸增加。这会导致应用程序在停止在线录制时崩溃 - mMediaRecorder.stop(); 。 java.
运行功能时 stop("m Sys.setenv(LANG = "fr") > 2 + x Erreur : objet 'x' introuvable > Sys.setenv(LANG = "en
我有一个 Windows 10 内部版本,我正在尝试安装 cpriego/valet-linux使用 wsl2 我已经安装了 composer、php 和所有其他的要求。 现在当我做 valet st
我是一名优秀的程序员,十分优秀!