// How can I rewrite this loop to C++ from C
// I dont know how to define vectors x, z, and v!
// x, z, and v are vectors, and N is the number of vectors x and z (N=2).
c:= 10;
N:= 2;
p:= 3;
b:=5;
for r:= 1 to p do {
sum(i:= 1 to N, v[i,r]) = 1;
sum(i:= 1 to N, v[i,r]*z[i]) = zz[r];
sum(i:= 1 to N, v[i,r]*x[i]) = b;
}
rela
0
Light Poster
Recommended Answers
Jump to PostThat's not C code -- looks more like pascal or java.'
At any rate, in C/C++ you have to declare variables before they can be used. so if you want to use a vector then you have to incude the vecor heade file
#include <vector> using …
All 4 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
Hiroshe
499
Posting Whiz in Training
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.