当前位置:网站首页>怎样写一个增广矩阵到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;
}
边栏推荐
- Jerry's about TWS pairing mode configuration [chapter]
- TCP/IP 协议栈
- Use camunda to do workflow design and reject operations
- Have you ever been confused? Once a test / development programmer, ignorant gadget C bird upgrade
- Talk about relational database and serverless
- ByteDance senior engineer interview, easy to get started, fluent
- Win11如何解禁键盘?Win11解禁键盘的方法
- Backup tidb cluster to persistent volume
- Hdu4876zcc love cards (multi check questions)
- Usage of MySQL subquery keywords (exists)
猜你喜欢
双塔模型的最强出装,谷歌又开始玩起“老古董”了?
Pre sale 179000, hengchi 5 can fire? Product power online depends on how it is sold
Ten thousand word summary data storage, three knowledge points
Qt编写物联网管理平台39-报警联动
Jenkins user rights management
Kirin Xin'an operating system derivative solution | storage multipath management system, effectively improving the reliability of data transmission
Node:504 error reporting
The new version of onespin 360 DV has been released, refreshing the experience of FPGA formal verification function
Using enumeration to realize English to braille
Redis - basic use (key, string, list, set, Zset, hash, geo, bitmap, hyperloglog, transaction)
随机推荐
NVR hard disk video recorder is connected to easycvr through the national standard gb28181 protocol. What is the reason why the device channel information is not displayed?
Talk about relational database and serverless
大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?
Redis - basic use (key, string, list, set, Zset, hash, geo, bitmap, hyperloglog, transaction)
Meta force force meta universe system development fossage model
GridView defines its own time for typesetting "suggestions collection"
South China x99 platform chicken blood tutorial
Demon daddy A1 speech listening initial challenge
648. Word replacement
The maximum number of meetings you can attend [greedy + priority queue]
Validutil, "Rethinking the setting of semi supervised learning on graphs"
Insufficient permissions
[open source] Net ORM accessing Firebird database
Time standard library
SQL injection error report injection function graphic explanation
Win11时间怎么显示星期几?Win11怎么显示今天周几?
EasyUI date control emptying value
Google SEO external chain backlinks research tool recommendation
Navicat connect 2002 - can't connect to local MySQL server through socket '/var/lib/mysql/mysql Sock 'solve
Where is the big data open source project, one-stop fully automated full life cycle operation and maintenance steward Chengying (background)?