#include <stdio.h>
#include <windows.h>
int main()
{
SetConsoleTitle("MathTable Gen [beta]");
system("color 17");
system("mode 55,40");
int num,x;
printf("\n\t\tGenerate table of : ");
scanf("%d",&num);
if (num <=1000)
{
for (x=0;x<=10;x=x+1)
{
printf("\n\t%d\tx\t%d\t=\t%d\n\n",num,x,num*x);
}
printf("\n Created by : Naveen Niraula !");
}
else
{
system("mode 70,15");
SetConsoleTitle("MathTable Gen [beta] - Error!");
system("cls");
printf("\n\n\n\n\n You either entered an invalid number or entered a value too big !\n\n\t \t \tBetter try again. :)");
printf("\n\n\n\t\t Created by : Naveen Niraula !");
getch();
return;
}
getch();
return();
}
好的,这是我学习了一点之后的第一个 C 程序。
现在我唯一的问题是如何将 ICON 添加到我的程序中?
哦,我正在使用 Code::Blocks 作为我的 C IDE。我希望有人能帮我清关?
最佳答案
要添加图标,您需要使用以下条目编写资源脚本 (.rc)
IDI_ICON1 ICON "myIcon.ico"
这会将 myIcon 文件添加到您的应用程序中。 然后需要使用资源编译器 (rc.exe) 编译 rc 文件,您应该在默认编译器安装文件夹中找到它。这会生成一个 .res 文件,您可以将该文件与程序的其他目标文件一起传递给链接器。
更多信息请引用以下链接: about resource files
可以下载SDK包中的资源编译器here
关于c - 如何在 C 中向我的控制台程序添加图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25322462/