当前位置:网站首页>怎样写一个增广矩阵到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 fast pairing does not support canceling pairing [article]
- Demon daddy B2 breaks through grammar and completes orthodox oral practice
- Devil daddy B1 hearing the last barrier, break through with all his strength
- Jerry's test box configuration channel [chapter]
- Codemail auto collation code of visual studio plug-in
- The little money made by the program ape is a P!
- Win11如何解禁键盘?Win11解禁键盘的方法
- Redis - basic use (key, string, list, set, Zset, hash, geo, bitmap, hyperloglog, transaction)
- 用语雀写文章了,功能真心强大!
- [open source] Net ORM accessing Firebird database
猜你喜欢

建立自己的网站(18)

Problems encountered in installing mysql8 for Ubuntu and the detailed installation process

Use json Stringify() to realize deep copy, be careful, there may be a huge hole

Automatic classification of defective photovoltaic module cells in electronic images

Display optimization when the resolution of easycvr configuration center video recording plan page is adjusted
![The maximum number of meetings you can attend [greedy + priority queue]](/img/f3/e8e939e0393efc404cc159d7d33364.png)
The maximum number of meetings you can attend [greedy + priority queue]

Qt编写物联网管理平台39-报警联动

海外代理推荐

双塔模型的最强出装,谷歌又开始玩起“老古董”了?
![[C language] advanced pointer --- do you really understand pointer?](/img/ee/79c0646d4f1bfda9543345b9da0f25.png)
[C language] advanced pointer --- do you really understand pointer?
随机推荐
Wechat official account oauth2.0 authorizes login and displays user information
Hdu4876zcc love cards (multi check questions)
Reptile combat (VII): pictures of the king of reptiles' heroes
Latest Android advanced interview questions summary, Android interview questions and answers
Implementation of mahout Pearson correlation
Deadlock conditions and preventive treatment [easy to understand]
你可曾迷茫?曾经的测试/开发程序员,懵懂的小菜C鸟升级......
Jenkins user rights management
Devil daddy A0 English zero foundation self-improvement Road
MIT6.S081-Lab9 FS [2021Fall]
ISO 26262 - considerations other than requirements based testing
谈谈制造企业如何制定敏捷的数字化转型策略
Win11游戏模式怎么开启?Win11开启游戏模式的方法
Usage of MySQL subquery keywords (exists)
Cv2.resize function reports an error: error: (-215:assertion failed) func= 0 in function ‘cv::hal::resize‘
使用 BlocConsumer 同时构建响应式组件和监听状态
[open source] Net ORM accessing Firebird database
Index summary (assault version)
[open source] Net ORM accessing Firebird database
大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?