Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
array_solution.cpp
Package: n_chouliujisuan.rar [view]
Upload User: jinqiu1010
Upload Date: 2021-09-06
Package Size: 3082k
Code Size: 1k
Category:
Energy industry
Development Platform:
C/C++
- // array_solution.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #define n 3
- void array_solution(float array[][n+1],float x[n])
- {
- int i,j,k;
- for(i=0;i<n-1;i++)
- for(j=i+1;j<n;j++)
- for(k=j;k<n+1;k++)
- array[j][k]=array[j][k]-array[i][k]*(array[j][i]/array[i][i]);
- for(i=0;i<n;i++)
- {
- for(j=0;j<n+1;j++)
- {
- printf("%f",array[i][j]);
- printf(" ");
- }
- printf("n");
- }
- x[n-1]=array[n-1][n]/array[n-1][n-1];
- for(j=n-2;j>=0;j--)
- {
- float sum=0.0;
- for(i=n-1;i>j;i--)
- sum=sum+array[j][i]*x[i];
- x[j]=(array[j][n]-sum)/array[j][j];
- }
- for(i=0;i<n;i++)
- printf("x[%d]=%f ",i,x[i]);
- }
- int main(int argc, char* argv[])
- {
- float a[3][4]={{1,1,1,6},{1,1,-1,0},{-1,1,-1,-2}},x[n];
- array_solution(a,x);
- return 0;
- }