first commit
This commit is contained in:
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="CPP_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/05_printf.iml" filepath="$PROJECT_DIR$/.idea/05_printf.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+50
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeSettings">
|
||||
<configurations>
|
||||
<configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="31f10055-069d-473b-9478-0309bc257748" name="Changes" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ClangdSettings">
|
||||
<option name="formatViaClangd" value="false" />
|
||||
</component>
|
||||
<component name="ProjectId" id="2QQgIoSTflB0TzMXNpGO2ORQeSd" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.cidr.known.project.marker": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"cf.first.check.clang-format": "false",
|
||||
"cidr.known.project.marker": "true",
|
||||
"last_opened_file_path": "D:/GitHome/QianFeng/C_lang/05_printf",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="31f10055-069d-473b-9478-0309bc257748" name="Changes" comment="" />
|
||||
<created>1685291143580</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1685291143580</updated>
|
||||
<workItem from="1685291144185" duration="50000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,6 @@
|
||||
TEMPLATE = app
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
CONFIG -= qt
|
||||
|
||||
SOURCES += main.c
|
||||
@@ -0,0 +1,46 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int a = 100;
|
||||
|
||||
printf("a = %d\n",a);
|
||||
|
||||
printf("a = %o\n",a); // 八进制输出
|
||||
printf("a = %#o\n",a); // %#o 可以输出八进制数的前导符
|
||||
|
||||
printf("a = %x\n",a); // 十六进制输出
|
||||
printf("a = %#x\n",a);
|
||||
|
||||
// 输出浮点型数据,float使用%f,double使用%lf
|
||||
float b = 3.1415926;
|
||||
double c = 2345.2345;
|
||||
printf("b = %f\n",b);
|
||||
printf("c = %lf\n",c);
|
||||
|
||||
// 输出字符,使用%c使出字符,使用%d可以输出字符的ascii码值
|
||||
char d = 'y';
|
||||
printf("d = %c %d\n",d,d);
|
||||
|
||||
char e[] = "hello world";
|
||||
printf("e = %s\n",e);
|
||||
|
||||
// 输出地址,使用%p
|
||||
int f = 999;
|
||||
// &:取一个变量的地址,一般地址用十六进制标识
|
||||
printf("&p = %#p\n", &f); // 获取当前变量的地址用 %p
|
||||
|
||||
|
||||
int m = 456;
|
||||
printf("%d%d\n", m, m);
|
||||
printf("%5d%5d\n", m, m);
|
||||
// %05d:输出的宽度为5,右对齐,如果实际数据的宽度小于5,则左边位置补0
|
||||
printf("%05d%05d\n", m, m);
|
||||
//%-5d:输出的宽度为5,左对齐,如果实际数据的宽度小于5,则右边补空格
|
||||
printf("%-5d%-5d\n", m, m);
|
||||
|
||||
float n = 3.678;
|
||||
printf("n = %f\n", n);
|
||||
//%.2f:小数点后保留两位,并且可以四舍五入
|
||||
printf("n = %.2f\n", n);
|
||||
}
|
||||
Reference in New Issue
Block a user