How do i make each vector in a 2D vector different?
Good evening all, I am trying to get a vector of vectors to store essentially a table of values where the second column uses the number from the first to calculate it and well, it is not working.
I want it to store my values like:
T R
0 | 20 [R1]
1 | 30 [R2]
2 | 40 [R3]
3 | 50 [R4]
4 | 60 [R5]
[Continues until hits last number]
The numbers along the left side are the rows like Stuff[0][T] = 20, etc
So T would be vector<double>Temp and R would be vector<double>Resistance and
they are both contained in vector<vector<double> >Stuff.
And so the R vector would use the values of T to calculate the resistance.
int main ()
{
double InitTemp,FinTemp,TempIncr;
vector <vector <double> > Stuff;
cout << "What is the range of temperatures being tested?(Initial Final) ";
cin >> InitTemp >> FinTemp;
cout << "How much would you like each temperature to increment? ";
cin >> TempIncr;
for(int i = 0; i < 2; i++)
{
vector <double> Temp;
vector<double> Resistance;
if(i == 0)
{
for (int j = InitTemp; j <= FinTemp; j+=TempIncr)
Temp.push_back(j);
Stuff.push_back(Temp);
}
if(i == 1)
{
double R=0;
for(int k = 0; k < Temp.size();k++)
{
R = Temp[k]+1;
Resistance.push_back(R);
}
Stuff.push_back(Resistance);
}
for (int i = 0; i< Stuff.size(); i++)
{
for(int j = 0; j < Stuff[i].size(); j++)
cout << Stuff[i][j] << " ";
cout << endl;
}
This piece of program will go in another larger program that uses a function to calculate the resistance but I still need to use Temp to do so which is why I have it just adding 1 to the temp as a placeholder.
My output looks like this:
What is the range of temperatures being tested?(Initial Final) 20 200
How much would you like each temperature to increment? 10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
Press any key to continue . . .
It does not output my second vector, if it even made it. Please help me understand
c++ vector
add a comment |
Good evening all, I am trying to get a vector of vectors to store essentially a table of values where the second column uses the number from the first to calculate it and well, it is not working.
I want it to store my values like:
T R
0 | 20 [R1]
1 | 30 [R2]
2 | 40 [R3]
3 | 50 [R4]
4 | 60 [R5]
[Continues until hits last number]
The numbers along the left side are the rows like Stuff[0][T] = 20, etc
So T would be vector<double>Temp and R would be vector<double>Resistance and
they are both contained in vector<vector<double> >Stuff.
And so the R vector would use the values of T to calculate the resistance.
int main ()
{
double InitTemp,FinTemp,TempIncr;
vector <vector <double> > Stuff;
cout << "What is the range of temperatures being tested?(Initial Final) ";
cin >> InitTemp >> FinTemp;
cout << "How much would you like each temperature to increment? ";
cin >> TempIncr;
for(int i = 0; i < 2; i++)
{
vector <double> Temp;
vector<double> Resistance;
if(i == 0)
{
for (int j = InitTemp; j <= FinTemp; j+=TempIncr)
Temp.push_back(j);
Stuff.push_back(Temp);
}
if(i == 1)
{
double R=0;
for(int k = 0; k < Temp.size();k++)
{
R = Temp[k]+1;
Resistance.push_back(R);
}
Stuff.push_back(Resistance);
}
for (int i = 0; i< Stuff.size(); i++)
{
for(int j = 0; j < Stuff[i].size(); j++)
cout << Stuff[i][j] << " ";
cout << endl;
}
This piece of program will go in another larger program that uses a function to calculate the resistance but I still need to use Temp to do so which is why I have it just adding 1 to the temp as a placeholder.
My output looks like this:
What is the range of temperatures being tested?(Initial Final) 20 200
How much would you like each temperature to increment? 10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
Press any key to continue . . .
It does not output my second vector, if it even made it. Please help me understand
c++ vector
Why don't you use something like a vector ofstd::pair<vector<double>, vector<double>>
?
– Some programmer dude
Nov 22 '18 at 5:23
As for your problem with the current code, with the input you specify, what is the expected output? Please read about how to ask good questions, as well as this question checklist. And please learn how to debug your programs.
– Some programmer dude
Nov 22 '18 at 5:24
Or perhaps you want a vector ofstd::map<double, std::vector<double>>
? It's not quite clear to me.
– Some programmer dude
Nov 22 '18 at 5:31
@Eddie: Is the value of R just 1 more than the value of Temp?
– P.W
Nov 22 '18 at 5:47
The output should be the vector of vectors to show it stores the values correctly with each row as (Temperature) (Resistance) [End Line] but it just prints out (Temperature) [End Line] right now, I am not sure if the program is calculating R and not displaying it or not displaying R because it was not calculated. R right now is just one more of Temp, this whole program is to make sure this part works before I put it into a much larger program so R will eventually call a function to calculate the resistance at the temperature to the left in the first vector.
– Eddie Gustin Jr
Nov 22 '18 at 6:05
add a comment |
Good evening all, I am trying to get a vector of vectors to store essentially a table of values where the second column uses the number from the first to calculate it and well, it is not working.
I want it to store my values like:
T R
0 | 20 [R1]
1 | 30 [R2]
2 | 40 [R3]
3 | 50 [R4]
4 | 60 [R5]
[Continues until hits last number]
The numbers along the left side are the rows like Stuff[0][T] = 20, etc
So T would be vector<double>Temp and R would be vector<double>Resistance and
they are both contained in vector<vector<double> >Stuff.
And so the R vector would use the values of T to calculate the resistance.
int main ()
{
double InitTemp,FinTemp,TempIncr;
vector <vector <double> > Stuff;
cout << "What is the range of temperatures being tested?(Initial Final) ";
cin >> InitTemp >> FinTemp;
cout << "How much would you like each temperature to increment? ";
cin >> TempIncr;
for(int i = 0; i < 2; i++)
{
vector <double> Temp;
vector<double> Resistance;
if(i == 0)
{
for (int j = InitTemp; j <= FinTemp; j+=TempIncr)
Temp.push_back(j);
Stuff.push_back(Temp);
}
if(i == 1)
{
double R=0;
for(int k = 0; k < Temp.size();k++)
{
R = Temp[k]+1;
Resistance.push_back(R);
}
Stuff.push_back(Resistance);
}
for (int i = 0; i< Stuff.size(); i++)
{
for(int j = 0; j < Stuff[i].size(); j++)
cout << Stuff[i][j] << " ";
cout << endl;
}
This piece of program will go in another larger program that uses a function to calculate the resistance but I still need to use Temp to do so which is why I have it just adding 1 to the temp as a placeholder.
My output looks like this:
What is the range of temperatures being tested?(Initial Final) 20 200
How much would you like each temperature to increment? 10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
Press any key to continue . . .
It does not output my second vector, if it even made it. Please help me understand
c++ vector
Good evening all, I am trying to get a vector of vectors to store essentially a table of values where the second column uses the number from the first to calculate it and well, it is not working.
I want it to store my values like:
T R
0 | 20 [R1]
1 | 30 [R2]
2 | 40 [R3]
3 | 50 [R4]
4 | 60 [R5]
[Continues until hits last number]
The numbers along the left side are the rows like Stuff[0][T] = 20, etc
So T would be vector<double>Temp and R would be vector<double>Resistance and
they are both contained in vector<vector<double> >Stuff.
And so the R vector would use the values of T to calculate the resistance.
int main ()
{
double InitTemp,FinTemp,TempIncr;
vector <vector <double> > Stuff;
cout << "What is the range of temperatures being tested?(Initial Final) ";
cin >> InitTemp >> FinTemp;
cout << "How much would you like each temperature to increment? ";
cin >> TempIncr;
for(int i = 0; i < 2; i++)
{
vector <double> Temp;
vector<double> Resistance;
if(i == 0)
{
for (int j = InitTemp; j <= FinTemp; j+=TempIncr)
Temp.push_back(j);
Stuff.push_back(Temp);
}
if(i == 1)
{
double R=0;
for(int k = 0; k < Temp.size();k++)
{
R = Temp[k]+1;
Resistance.push_back(R);
}
Stuff.push_back(Resistance);
}
for (int i = 0; i< Stuff.size(); i++)
{
for(int j = 0; j < Stuff[i].size(); j++)
cout << Stuff[i][j] << " ";
cout << endl;
}
This piece of program will go in another larger program that uses a function to calculate the resistance but I still need to use Temp to do so which is why I have it just adding 1 to the temp as a placeholder.
My output looks like this:
What is the range of temperatures being tested?(Initial Final) 20 200
How much would you like each temperature to increment? 10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
Press any key to continue . . .
It does not output my second vector, if it even made it. Please help me understand
c++ vector
c++ vector
edited Nov 22 '18 at 6:11
Eddie Gustin Jr
asked Nov 22 '18 at 5:18
Eddie Gustin JrEddie Gustin Jr
133
133
Why don't you use something like a vector ofstd::pair<vector<double>, vector<double>>
?
– Some programmer dude
Nov 22 '18 at 5:23
As for your problem with the current code, with the input you specify, what is the expected output? Please read about how to ask good questions, as well as this question checklist. And please learn how to debug your programs.
– Some programmer dude
Nov 22 '18 at 5:24
Or perhaps you want a vector ofstd::map<double, std::vector<double>>
? It's not quite clear to me.
– Some programmer dude
Nov 22 '18 at 5:31
@Eddie: Is the value of R just 1 more than the value of Temp?
– P.W
Nov 22 '18 at 5:47
The output should be the vector of vectors to show it stores the values correctly with each row as (Temperature) (Resistance) [End Line] but it just prints out (Temperature) [End Line] right now, I am not sure if the program is calculating R and not displaying it or not displaying R because it was not calculated. R right now is just one more of Temp, this whole program is to make sure this part works before I put it into a much larger program so R will eventually call a function to calculate the resistance at the temperature to the left in the first vector.
– Eddie Gustin Jr
Nov 22 '18 at 6:05
add a comment |
Why don't you use something like a vector ofstd::pair<vector<double>, vector<double>>
?
– Some programmer dude
Nov 22 '18 at 5:23
As for your problem with the current code, with the input you specify, what is the expected output? Please read about how to ask good questions, as well as this question checklist. And please learn how to debug your programs.
– Some programmer dude
Nov 22 '18 at 5:24
Or perhaps you want a vector ofstd::map<double, std::vector<double>>
? It's not quite clear to me.
– Some programmer dude
Nov 22 '18 at 5:31
@Eddie: Is the value of R just 1 more than the value of Temp?
– P.W
Nov 22 '18 at 5:47
The output should be the vector of vectors to show it stores the values correctly with each row as (Temperature) (Resistance) [End Line] but it just prints out (Temperature) [End Line] right now, I am not sure if the program is calculating R and not displaying it or not displaying R because it was not calculated. R right now is just one more of Temp, this whole program is to make sure this part works before I put it into a much larger program so R will eventually call a function to calculate the resistance at the temperature to the left in the first vector.
– Eddie Gustin Jr
Nov 22 '18 at 6:05
Why don't you use something like a vector of
std::pair<vector<double>, vector<double>>
?– Some programmer dude
Nov 22 '18 at 5:23
Why don't you use something like a vector of
std::pair<vector<double>, vector<double>>
?– Some programmer dude
Nov 22 '18 at 5:23
As for your problem with the current code, with the input you specify, what is the expected output? Please read about how to ask good questions, as well as this question checklist. And please learn how to debug your programs.
– Some programmer dude
Nov 22 '18 at 5:24
As for your problem with the current code, with the input you specify, what is the expected output? Please read about how to ask good questions, as well as this question checklist. And please learn how to debug your programs.
– Some programmer dude
Nov 22 '18 at 5:24
Or perhaps you want a vector of
std::map<double, std::vector<double>>
? It's not quite clear to me.– Some programmer dude
Nov 22 '18 at 5:31
Or perhaps you want a vector of
std::map<double, std::vector<double>>
? It's not quite clear to me.– Some programmer dude
Nov 22 '18 at 5:31
@Eddie: Is the value of R just 1 more than the value of Temp?
– P.W
Nov 22 '18 at 5:47
@Eddie: Is the value of R just 1 more than the value of Temp?
– P.W
Nov 22 '18 at 5:47
The output should be the vector of vectors to show it stores the values correctly with each row as (Temperature) (Resistance) [End Line] but it just prints out (Temperature) [End Line] right now, I am not sure if the program is calculating R and not displaying it or not displaying R because it was not calculated. R right now is just one more of Temp, this whole program is to make sure this part works before I put it into a much larger program so R will eventually call a function to calculate the resistance at the temperature to the left in the first vector.
– Eddie Gustin Jr
Nov 22 '18 at 6:05
The output should be the vector of vectors to show it stores the values correctly with each row as (Temperature) (Resistance) [End Line] but it just prints out (Temperature) [End Line] right now, I am not sure if the program is calculating R and not displaying it or not displaying R because it was not calculated. R right now is just one more of Temp, this whole program is to make sure this part works before I put it into a much larger program so R will eventually call a function to calculate the resistance at the temperature to the left in the first vector.
– Eddie Gustin Jr
Nov 22 '18 at 6:05
add a comment |
1 Answer
1
active
oldest
votes
Go for a std::vector
of std::pair<double, double>
. Then your code will become much simpler. The first double
is Temperature
and the second is Resistance
. From what I see in your code, Resistance
is just 1 added to Temperature
. In that case the following code should work:
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
double InitTemp, FinTemp, TempIncr;
vector <pair<double, double > > Stuff;
cout << "What is the range of temperatures being tested?(Initial Final) ";
cin >> InitTemp >> FinTemp;
cout << "How much would you like each temperature to increment? ";
cin >> TempIncr;
for (int j = InitTemp; j <= FinTemp; j += TempIncr)
Stuff.emplace_back(j, j+1);
for (int i = 0; i < Stuff.size(); i++)
{
cout << Stuff[i].first << ", " << Stuff[i].second << endl;
}
}
The output of R was supposed to be that you can still call a value from vector Temp to show it works, but i replaced "j+1" with a function call plus its needed parameters and it works so thank you :) I actually did not know about emplace_back, my C++ teacher only taught us the push_back one. I also learned everything I know about vectors in the last ~5 hours because its extra credit to use them instead of arrays so thank you for showing me the '.first' and the pair function.
– Eddie Gustin Jr
Nov 22 '18 at 6:41
@EddieGustinJr: You are welcome. :) Happy learning.
– P.W
Nov 22 '18 at 6:43
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424305%2fhow-do-i-make-each-vector-in-a-2d-vector-different%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Go for a std::vector
of std::pair<double, double>
. Then your code will become much simpler. The first double
is Temperature
and the second is Resistance
. From what I see in your code, Resistance
is just 1 added to Temperature
. In that case the following code should work:
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
double InitTemp, FinTemp, TempIncr;
vector <pair<double, double > > Stuff;
cout << "What is the range of temperatures being tested?(Initial Final) ";
cin >> InitTemp >> FinTemp;
cout << "How much would you like each temperature to increment? ";
cin >> TempIncr;
for (int j = InitTemp; j <= FinTemp; j += TempIncr)
Stuff.emplace_back(j, j+1);
for (int i = 0; i < Stuff.size(); i++)
{
cout << Stuff[i].first << ", " << Stuff[i].second << endl;
}
}
The output of R was supposed to be that you can still call a value from vector Temp to show it works, but i replaced "j+1" with a function call plus its needed parameters and it works so thank you :) I actually did not know about emplace_back, my C++ teacher only taught us the push_back one. I also learned everything I know about vectors in the last ~5 hours because its extra credit to use them instead of arrays so thank you for showing me the '.first' and the pair function.
– Eddie Gustin Jr
Nov 22 '18 at 6:41
@EddieGustinJr: You are welcome. :) Happy learning.
– P.W
Nov 22 '18 at 6:43
add a comment |
Go for a std::vector
of std::pair<double, double>
. Then your code will become much simpler. The first double
is Temperature
and the second is Resistance
. From what I see in your code, Resistance
is just 1 added to Temperature
. In that case the following code should work:
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
double InitTemp, FinTemp, TempIncr;
vector <pair<double, double > > Stuff;
cout << "What is the range of temperatures being tested?(Initial Final) ";
cin >> InitTemp >> FinTemp;
cout << "How much would you like each temperature to increment? ";
cin >> TempIncr;
for (int j = InitTemp; j <= FinTemp; j += TempIncr)
Stuff.emplace_back(j, j+1);
for (int i = 0; i < Stuff.size(); i++)
{
cout << Stuff[i].first << ", " << Stuff[i].second << endl;
}
}
The output of R was supposed to be that you can still call a value from vector Temp to show it works, but i replaced "j+1" with a function call plus its needed parameters and it works so thank you :) I actually did not know about emplace_back, my C++ teacher only taught us the push_back one. I also learned everything I know about vectors in the last ~5 hours because its extra credit to use them instead of arrays so thank you for showing me the '.first' and the pair function.
– Eddie Gustin Jr
Nov 22 '18 at 6:41
@EddieGustinJr: You are welcome. :) Happy learning.
– P.W
Nov 22 '18 at 6:43
add a comment |
Go for a std::vector
of std::pair<double, double>
. Then your code will become much simpler. The first double
is Temperature
and the second is Resistance
. From what I see in your code, Resistance
is just 1 added to Temperature
. In that case the following code should work:
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
double InitTemp, FinTemp, TempIncr;
vector <pair<double, double > > Stuff;
cout << "What is the range of temperatures being tested?(Initial Final) ";
cin >> InitTemp >> FinTemp;
cout << "How much would you like each temperature to increment? ";
cin >> TempIncr;
for (int j = InitTemp; j <= FinTemp; j += TempIncr)
Stuff.emplace_back(j, j+1);
for (int i = 0; i < Stuff.size(); i++)
{
cout << Stuff[i].first << ", " << Stuff[i].second << endl;
}
}
Go for a std::vector
of std::pair<double, double>
. Then your code will become much simpler. The first double
is Temperature
and the second is Resistance
. From what I see in your code, Resistance
is just 1 added to Temperature
. In that case the following code should work:
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
double InitTemp, FinTemp, TempIncr;
vector <pair<double, double > > Stuff;
cout << "What is the range of temperatures being tested?(Initial Final) ";
cin >> InitTemp >> FinTemp;
cout << "How much would you like each temperature to increment? ";
cin >> TempIncr;
for (int j = InitTemp; j <= FinTemp; j += TempIncr)
Stuff.emplace_back(j, j+1);
for (int i = 0; i < Stuff.size(); i++)
{
cout << Stuff[i].first << ", " << Stuff[i].second << endl;
}
}
answered Nov 22 '18 at 6:01
P.WP.W
18k41657
18k41657
The output of R was supposed to be that you can still call a value from vector Temp to show it works, but i replaced "j+1" with a function call plus its needed parameters and it works so thank you :) I actually did not know about emplace_back, my C++ teacher only taught us the push_back one. I also learned everything I know about vectors in the last ~5 hours because its extra credit to use them instead of arrays so thank you for showing me the '.first' and the pair function.
– Eddie Gustin Jr
Nov 22 '18 at 6:41
@EddieGustinJr: You are welcome. :) Happy learning.
– P.W
Nov 22 '18 at 6:43
add a comment |
The output of R was supposed to be that you can still call a value from vector Temp to show it works, but i replaced "j+1" with a function call plus its needed parameters and it works so thank you :) I actually did not know about emplace_back, my C++ teacher only taught us the push_back one. I also learned everything I know about vectors in the last ~5 hours because its extra credit to use them instead of arrays so thank you for showing me the '.first' and the pair function.
– Eddie Gustin Jr
Nov 22 '18 at 6:41
@EddieGustinJr: You are welcome. :) Happy learning.
– P.W
Nov 22 '18 at 6:43
The output of R was supposed to be that you can still call a value from vector Temp to show it works, but i replaced "j+1" with a function call plus its needed parameters and it works so thank you :) I actually did not know about emplace_back, my C++ teacher only taught us the push_back one. I also learned everything I know about vectors in the last ~5 hours because its extra credit to use them instead of arrays so thank you for showing me the '.first' and the pair function.
– Eddie Gustin Jr
Nov 22 '18 at 6:41
The output of R was supposed to be that you can still call a value from vector Temp to show it works, but i replaced "j+1" with a function call plus its needed parameters and it works so thank you :) I actually did not know about emplace_back, my C++ teacher only taught us the push_back one. I also learned everything I know about vectors in the last ~5 hours because its extra credit to use them instead of arrays so thank you for showing me the '.first' and the pair function.
– Eddie Gustin Jr
Nov 22 '18 at 6:41
@EddieGustinJr: You are welcome. :) Happy learning.
– P.W
Nov 22 '18 at 6:43
@EddieGustinJr: You are welcome. :) Happy learning.
– P.W
Nov 22 '18 at 6:43
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424305%2fhow-do-i-make-each-vector-in-a-2d-vector-different%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why don't you use something like a vector of
std::pair<vector<double>, vector<double>>
?– Some programmer dude
Nov 22 '18 at 5:23
As for your problem with the current code, with the input you specify, what is the expected output? Please read about how to ask good questions, as well as this question checklist. And please learn how to debug your programs.
– Some programmer dude
Nov 22 '18 at 5:24
Or perhaps you want a vector of
std::map<double, std::vector<double>>
? It's not quite clear to me.– Some programmer dude
Nov 22 '18 at 5:31
@Eddie: Is the value of R just 1 more than the value of Temp?
– P.W
Nov 22 '18 at 5:47
The output should be the vector of vectors to show it stores the values correctly with each row as (Temperature) (Resistance) [End Line] but it just prints out (Temperature) [End Line] right now, I am not sure if the program is calculating R and not displaying it or not displaying R because it was not calculated. R right now is just one more of Temp, this whole program is to make sure this part works before I put it into a much larger program so R will eventually call a function to calculate the resistance at the temperature to the left in the first vector.
– Eddie Gustin Jr
Nov 22 '18 at 6:05