当前位置:网站首页>怎样写一个增广矩阵到txt文件中
怎样写一个增广矩阵到txt文件中
2022-07-07 21:37:00 【51CTO】
写一个398行,399列的矩阵
#include<iostream>
using namespace std;
int main()
{
float arr1[450];
float c=1.0;
float b=2.0;
int i=0,j=0;
FILE *fp;
for(i=0;i<400;i++)
{
arr1[i]=i;
}
fp=fopen("aaa.txt","w");
for(i=0;i<399;i++)
{
for(j=0;j<=399;j++)
{
if(j==i)
fprintf(fp,"%f%c",b,' ');
else if(j==i+1 && i!=398)
fprintf(fp,"%f%c",c,' ');
else if(j==i-1)
fprintf(fp,"%f%c",c,' ');
else if(j==399)
{
fprintf(fp,"%f%c",arr1[i],' ');
}
else
fprintf(fp,"%f%c",0.0,' ');
}
}
fclose(fp);
cout<<arr1[9]<<endl;
return 0;
}
边栏推荐
- How polardb-x does distributed database hotspot analysis
- 三元表达式、各生成式、匿名函数
- Restore backup data on persistent volumes
- Main functions of OS, Sys and random Standard Libraries
- npm uninstall和rm直接删除的区别
- Build your own website (18)
- [JDBC Part 1] overview, get connection, CRUD
- Display optimization when the resolution of easycvr configuration center video recording plan page is adjusted
- Open source OA development platform: contract management user manual
- Matplotlib drawing interface settings
猜你喜欢
Use json Stringify() to realize deep copy, be careful, there may be a huge hole
648. Word replacement
EasyCVR配置中心录像计划页面调整分辨率时的显示优化
Node:504 error reporting
Ad domain group policy management
ISO 26262 - considerations other than requirements based testing
Cv2.resize function reports an error: error: (-215:assertion failed) func= 0 in function ‘cv::hal::resize‘
Implementation method of data platform landing
Jerry's about TWS channel configuration [chapter]
[200 opencv routines] 223 Polygon fitting for feature extraction (cv.approxpolydp)
随机推荐
npm uninstall和rm直接删除的区别
How does win11 time display the day of the week? How does win11 display the day of the week today?
【colmap】稀疏重建转为MVSNet格式输入
The cyberspace office announced the measures for data exit security assessment, which will come into force on September 1
谈谈制造企业如何制定敏捷的数字化转型策略
解决uni-app中uni.request发送POST请求没有反应。
Jerry's about TWS channel configuration [chapter]
Demon daddy B3 read extensively in a small amount, and completed 20000 vocabulary+
Navicat connect 2002 - can't connect to local MySQL server through socket '/var/lib/mysql/mysql Sock 'solve
Default constraint and zero fill constraint of MySQL constraint
三元表达式、各生成式、匿名函数
UVA 11080 – place the guards
Jetty: configure connector [easy to understand]
[C language] advanced pointer --- do you really understand pointer?
EasyUI date control emptying value
Jerry's test box configuration channel [chapter]
Awk processing JSON processing
NVR硬盤錄像機通過國標GB28181協議接入EasyCVR,設備通道信息不顯示是什麼原因?
【JDBC Part 1】概述、获取连接、CRUD
[开源] .Net ORM 访问 Firebird 数据库