I have been doing the programs as best I can as my book tells me to and some things just did'nt work.It started with square witch would square a number but i can do that manually without too much trouble so I did.Now it's to the point where i can't do anything else.Currently learning about vectors I learned the push_back operator but when I try to compile the program it says
'push_back' : is not a member of 'System::Double'
1> c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll : see declaration of 'System::Double'
My compiler is microft visual c++ express edition if that makes any difference and thank you all for your time and kindness.
K-Bal wrote:You should write temps instead of temp in line 7 and try to clean up your code a bit
witch one?
20 seconds of try and error
You are right.That was just plain laze and it shant happen again, however, this program does work but I don't know how to make it understand I want the medean and not to enter more data.Thanks to everyone your help is appreciated immencely.
The novice realizes that the difference between code and data is trivial. The expert realizes that all code is data. And the true master realizes that all data is code.
I am now trying, as per the instructions of my book, to add some doubles int a vector and make it output witch is the smallert largest and all of the numbers put together. I started with just the smallest part to keep it simple.Your program had a warning but the program seemed to work fine so I didn't mind it but now near the end it will say that debug assertion failed. Here is the warning and then the code in witch the warning is along with the line before and after.
double sum=0;
for (int i=0;i<temps.size();++i)sum+= temps[i];
cout<<"average temurature: "<<sum/temps.size()<<endl;
you are getting the warning because size() returns an "unsigned int", which means it can't be minus (which makes sense, since you can't have a size of -54). You can simply change your 2nd line of code to: