您的位置:首页 > 编程语言 > C语言/C++

分享C++/C如何开机自动启动代码和c的改错题

2016-01-07 18:28 501 查看
C++/C如何开机自动启动代码?
#include <stdio.h>
#include <windows.h>
int main()
{
HKEY hRoot = HKEY_LOCAL_MACHINE;
char *szSubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
char szModule[]="你的执行文件.exe";
HKEY hKey;// 打开指定子键
DWORD dwDisposition = REG_OPENED_EXISTING_KEY; // 如果不存在不创建
LONG lRet =  RegCreateKeyEx(hRoot, szSubKey,0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition);
if(lRet != ERROR_SUCCESS)
{
printf("创建子键出错\n");
return -1;
}
lRet = RegSetValueEx(hKey,"测试开机运行",0,REG_SZ,(BYTE*)szModule,strlen(szModule));
if(lRet == ERROR_SUCCESS)
printf("成功\n");
RegCloseKey(hKey);

}


问题:c语言程序改错

#include<stdio.h>

int main()

{
int max(int x,int y);
int i,a,j;
scanf("%d,%d",&i,&j);
a=max(i,j);
printf("%d",a);
return 0;
}
int max(int x, int y)
{int z,i,j;
z=x>y? x:y;
retu


rn(z);

}

去掉scanf里面的逗号 和不去掉里面的逗号 输出结果不一样为什么

回答:格式化输入,就是你用逗号隔开,输入时也用逗号隔开
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息