for my style, I changed some things:kostiak2 wrote:Code: Select all
for (unsigned int i=0;i<temps.size();++i)sum+= temps[i];
Code: Select all
for(unsigned i = 0; i < temps.size(); ++i)
sum += temps[i];
Moderator: Coders of Rage
for my style, I changed some things:kostiak2 wrote:Code: Select all
for (unsigned int i=0;i<temps.size();++i)sum+= temps[i];
Code: Select all
for(unsigned i = 0; i < temps.size(); ++i)
sum += temps[i];
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Code: Select all
for (unsigned int i=0;i<temps.size();++i)
{
sum+= temps[i];
}
The program will have to do a runtime conversion, making x = 0.K-Bal wrote:Yeah and what happens if you type in
unsigned x = 0.5f; ?
I guess, I'll try that out later.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Code: Select all
for (vector::size_type i = 0;i < myVector.size();++i)
Code: Select all
const unsigned int max = myVector.size();
for (unsigned int i = 0; i < max;++i)
Code: Select all
for (vector<myVecType>::iterator i = myVector.begin(); i != myVector.end();++i)
Code: Select all
vector<myVecType> myVector;
Code: Select all
const vector<myVecType>::iterator max = myVector.end();
for (vector<myVecType>::iterator i = myVector.begin(); i != max; ++i)
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Lmao.cplusplusnoob wrote:I am not sure if this is what you meant but it could be between line 19 and line 24.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Code: Select all
using namespace std;
int main()
{
vector<double>temps;
double temp;
while(cin>>temp)
temp.push_back(temp);
double sum=0;
for (int i=0; i<temps.size();++i)sum+= temps[i];
cout<<"average temurature: "<<sum/temps.size()<<endl;
sort(temps.begin(),temps.end());
cout<<"medean temurature: "<<temps[temps.size()/2]<<endl;
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.