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
P_Q_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++
- // P_Q_solution.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include"stdio.h"
- #define n 2
- main(int argc, char* argv[])
- {
- float P[n]={1,1.5};
- float Q[n]={1,2};
- float e[n]={1,1};
- float f[n]={0};
- float G[n][n]={{2,2},{1.5,20}},B[n][n]={{0.2,2.5},{0.15,2}};
- int i,j;
- float a,b,sump,sumq;
- for(i=0;i<n;i++)
- {sump=0;
- sumq=0;
- a=1;
- b=1;
- for(j=0;j<n;j++)
- {
- a=G[i][j]*e[j]-B[i][j]*f[j];
- b=G[i][j]*f[j]-B[i][j]*e[j];
- sump=e[i]*a+f[i]*b;
- sumq=f[i]*a-e[i]*b;
- P[i]=P[i]-sump;
- Q[i]=Q[i]-sumq;
- }
- }
- printf("deP,deQ分别为:n");
- for(i=0;i<n;i++)
- {
- printf("P[%d]=%f",i,P[i]);
- printf(" ");
- }
- }