This is the output I get from my program now, but after it ouputs the correct value it says outputs another number like -12323e.6 and then says "Program Complete!" again. How do i get rid of this second output? Im also getting an error message - line [14] conversion from double to float, possible loss of data. Thanks.
// Computer Lab test.cpp : Program that asks for temperature inputs,
// ensures input is in centigrade, and outputs # of arrays + corrected temp
// Andrew Stewart CMPT 201
#include "stdafx.h"
#include using namespace std;
float CheckCent(float c) // Function to convert user values into centigrade(celsius) <- function named CheckCent
{
if(c>30)
{
c=(c-32)/(1.80); return c; // formula for fahrenheit to celsius(centigrade)
}
else return c;
}
int _tmain(int argc, _TCHAR* argv[]) // Main function
{
float myarray[50]; // declare array from 0-49 values
int flag; // counter for loop
flag=1;
int i; // number of arrays
for(i = 0; i < 50 && flag == 1; i++)
{
cout << "Enter Temperature Reading:";
cin >>myarray[i];
cout << "Enter 1 to input more values, 0 to stop";
cin >>flag;
}// End for
cout << "\n\nNumber of elements in the array is: " << i <