当前位置:网站首页>怎样写一个增广矩阵到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;
}
边栏推荐
- [开源] .Net ORM 访问 Firebird 数据库
- Datatable data conversion to entity
- GridView defines its own time for typesetting "suggestions collection"
- The strongest installation of the twin tower model, Google is playing "antique" again?
- Index summary (assault version)
- The new version of onespin 360 DV has been released, refreshing the experience of FPGA formal verification function
- Debugging and handling the problem of jamming for about 30s during SSH login
- 谈谈制造企业如何制定敏捷的数字化转型策略
- Latest Android advanced interview questions summary, Android interview questions and answers
- Goal: do not exclude yaml syntax. Try to get started quickly
猜你喜欢
TCP/IP 协议栈
嵌入式开发:如何为项目选择合适的RTOS?
Default constraint and zero fill constraint of MySQL constraint
How to make agile digital transformation strategy for manufacturing enterprises
Validutil, "Rethinking the setting of semi supervised learning on graphs"
An overview of the latest research progress of "efficient deep segmentation of labels" at Shanghai Jiaotong University, which comprehensively expounds the deep segmentation methods of unsupervised, ro
operator
Crawler (17) - Interview (2) | crawler interview question bank
[开源] .Net ORM 访问 Firebird 数据库
Wechat official account oauth2.0 authorizes login and displays user information
随机推荐
Tsconfig of typescript TS basics JSON configuration options
Demon daddy B2 breaks through grammar and completes orthodox oral practice
The maximum number of meetings you can attend [greedy + priority queue]
QT compile IOT management platform 39 alarm linkage
Jerry's power on automatic pairing [chapter]
Jerry's test box configuration channel [chapter]
Deadlock conditions and preventive treatment [easy to understand]
Reinforcement learning - learning notes 9 | multi step TD target
Matplotlib drawing interface settings
Demon daddy guide post - simple version
Ad domain group policy management
Contour layout of margin
Latest Android advanced interview questions summary, Android interview questions and answers
Hdu4876zcc love cards (multi check questions)
An in-depth understanding of fp/fn/precision/recall
Use br to recover backup data on azure blob storage
Restore backup data on persistent volumes
L2:ZK-Rollup的现状,前景和痛点
How much does it cost to develop a small program mall?
Reinforcement learning - learning notes 9 | multi step TD target