i have a question, i kind of simple for you maybe.
I'm building a program that calculates plumbing for a building by Bricks. And the code is quite easy, I'm planing to make a header file so i can acces it whenever i need. So i plan to make all my variables stored to arrays and then ofstream it to a specific file with all of the values.
Im coding and compiling via Notepad++ and MinGW [g++ 4.8.1]
Also, i didn't get realy pointers and arrow member pointers so i don't use them realy, i was so angry last time i tried to make a program with it that i almost chrashed my PC.
Im not planing on showing you the not finished code for every part of the header by itself, because right now im having problems for reading the length of a array. But the basic concept of the program is :
Ask User for Element [bath, dishwasher, tub etc], the lenght of the pipe, and the intersect point. Program stops when user inputs ifrastructure.
that values are stored into arrays, and then the ofstream function is called with given values and extra functions [by Bricks] that show the desired data.
the problem is, a building can have from several to n points before it comes to infrastructure pipe line. But to add all the vales that fucntions returned from elements i need to sum them, but program don't knows the lenght of array of elements and variables, because it is by nature unknown.
i tried tricking the program as following :
keep in mind that im compiling all the programs in standalone type before i make them into header.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
double arrayValueOfElement[]={3.2,4.3} // array of value apointed by its name of the element
int n; // new number unknown by default;
aray[n]; // trying to assaign the value of n to number of elements
int i=0; // starting the basic value of i to 0
while(i<=n;) // while 1 is less or equal then n
{
i++; // increment i, and found the n;
}
cout<<i; // cout, later will be return
|
and even tried just i less to n, and any kind of loop i can think of, and combination of such, and
array.size();
as seen here in <array> but my compiler dont "understand" it ...
even tried copying some code that i've found in sites that use template with pointers and all, but i was lost because i didn't understand anything.
Also : i will learn pointers, i just need to calm down a bit.
Also pt 2 : i learn'd c++ on tutorials like bucky and such, english is not my primer language, soo it is kinda dificult to understand it. Although google translate nad c++ primer helps a bit.
Also pt3 : i'm not an student [i am, an civil engineering student] but not for this. I'm learning c++ and microelectronics for my own usage. So don't think that you are doing my homework or something similar.
So any help?