Visual C++ :: Finding Temperature At The End Of Interval But Can't Seem To Get Answer?

Oct 30, 2013

I've been trying to get the numbers for hours now but i can seem to get it right. Here's the problem below:

During the initial period, when the heater is not yet functioning at peak efficiency the heating will increase the temperature inside the building at a rate given by the following equations. During the initial period when the air conditioner is not yet functioning at peak efficacy the air conditioner will decrease the temperature inside the building at a rate given by the same equations.

Interval = (Time since turning on / 2.0 ) - 3.0
Factor multiplying Temperature change per minute = exp( Interval) / ( 1 + exp(Interval) )

These equations can also be used after the heating or air conditioner reaches peak efficiency. These equations converge to 1, so after the heating or air conditioner reach peak efficiency these equations will always give a value of 1.

the value of these equations needs to be multiplied by the RATE TEMPERATURE CHANGES. The RATE TEMPERATURE CHANGES is EITHER the change in temperature inside the building in degrees Celsius per minute caused by heat being extracted by the air conditioning OR the change in temperature inside the building in degrees Celsius per minute caused by the heat being generated by the heating .Temperature change in degrees per minute = Factor multiplying Temperature change per minute * RATE TEMPERATURE CHANGES

Temperature at end of this interval = Temperature at the start of the interval + temperature change due to heat escaping during the this interval + temperature change due to heat generated by the heating system during this interval + temperature change due to heat removed by the cooling system during this interval

i have a:

...rate of -.05 for heat escape w/o cooling or heating
...rate of 0.10 for heat escape w/ cooling
...rate of 0.125 for heat increase w/ heating
...Starting temp=38.00
...Time interval 3.50

I can't seem to find the temp at the ending interval? What i tried doing:

Code:
#include<iostream>
#include<cmath>
using namespace std;
int main () {
double intervals=0.00;
double tempPerMin=0.00;

[Code] ....

The temperature at the end of the interval is suppose to be 37.81 but i can't get the answer. I'm pretty sure this is a logical error from the equations i used but i can't seem to find it.

View 3 Replies


ADVERTISEMENT

C Sharp :: Maintain Temperature Of Grill And Measure Temperature Using Probe At 12 Points

Jan 16, 2013

I have to write a program for a restaurant and their food has to be cooked on a hot sheet of metal and too cook their burgers properly I must keep a maintain temp of 400 F, for the grill and to measure the temperature using a probe at 12 points, there are 3 elements with 3 points on them

View 2 Replies View Related

C++ :: Assign Value To Interval

Oct 2, 2014

This is my code , i should Assign value val to interval [keyBegin, keyEnd).

#include <assert.h>
#include <map>
#include <limits>

void assign( K const& keyBegin, K const& keyEnd, const V& val ) {

if(!(keyBegin<keyEnd))

[Code] .....

View 7 Replies View Related

C/C++ :: Number Of Twin Primes Between Interval?

Feb 11, 2015

I'm having some trouble finishing my code, it's meant to give the number of twin primes between an interval e.g. 1 to 1000000 and the answer should be 8169 but all I can get it to is 8168

#include <stdio.h>
int prime (int num) {
int div;
if (num == 2) return 1;
if (num % 2 == 0) return 0;
div = 3;
while (div*div <= num) {

[code]....

View 6 Replies View Related

C++ :: Running A Procedure Repeatedly After A Set Time Interval

May 28, 2013

I have a certain piece of code that I want to run every 2 minutes. One of my ideas is to get the time and modules that with whatever number represents 2 minutes. Would this work?

View 4 Replies View Related

C :: Generate Pseudo Random Real Number From Interval (0,1)

Feb 6, 2013

How can I generate a pseudo-random real number from interval [0,1] ?

Can it be generalized to any interval? Like [0,a], where 'a' is a parameter?

I tried searching for it, I only found rand(), srand(), random(1), and randomize. None of it actually seems to work for me..

Later I actually succeeded with something like

srand( (unsigned)time( NULL ) );
printf( " %6d
", rand() );

but it only produces up to five digits integers and I cannot divide by 99999 to get it into [0,1].

View 11 Replies View Related

C++ :: Program Which Allows A User To Enter Input For A Time Interval

Apr 23, 2014

how can i make a program which allows a user to enter an input for a time interval for example i ask a question and sets the input to be entered within 10 seconds...

View 4 Replies View Related

C++ :: Generate Numbers For A Binomial Coefficient From Number Interval

Mar 27, 2013

I'm trying to write a code which will generate numbers for a binomial coefficient from a number interval [2-10], i think it should look like this:

n=2
r=2
n=2
r=3
n=2
r=4
n=2
r=5
.
.
.
n=10
r=10
-The program should stop here.

This is badly written, but it still has the basic idea in it.

#include <iostream>
using namespace std;
int main () {
int n=2;
int r=1;

[Code] ....

View 1 Replies View Related

C++ :: Get Correct Answer For Every Value Of X / N And A

Jun 10, 2014

I am expecting to get correct answer for every value of x, n and a[i] where

-10^9 <= a[i] <= 10^9
1 <= x <= 10^18
and 1 <= n <= 10000

Every value here is an integer value

#include<cstdio>
#include<iostream>
#include<cmath>
#include <float.h>

#define sBig long long int

[Code] .....

View 1 Replies View Related

C++ :: End Loop After Answer Is 0

Mar 23, 2014

I am writing a program to tell how long it will take for a loan to be paid off supposing the desired loan is 100,000, the annual percentage rate is 6, and the monthly payment is 1,000. What happens is after I run the program, I get the output of "-24.60" after the last month is paid off. I'm trying to get it to where the last monthly payment is only enough to make the loan 0. Then I want the program to end.

#include <iostream>
#include <iomanip>
using namespace std;

[Code]....

View 4 Replies View Related

C :: Correct Answer Does Not End Game

Feb 21, 2013

Okay so I thought I had this assignment completed properly last week. Last night I found a bug while playing the game.why won't the game end when the player guesses the correct number? The game allows you to finish using the max number of guesses even though you already guessed the correct number.

Code:

#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#define MAXGUESSES 6
#define MAXGAMES 20
#define MAXNUMBER 100
}

[code]....

View 9 Replies View Related

Visual C++ :: Finding Items (strings) In Multiple Lists

Mar 12, 2013

Im working on a script compiler and i need to handle different types of data. Actually different categories of items.

Let's say i have two categories: cat's and bird's. They are different and stored in different lists. And let's say there is a simple command: GIVE_FOOD_TO(animal_type, food_type) Animal type here can be either from birds category or cat's category.

And also let's say user gives command: GIVE_FOOD_TO(cat1, fish)
and also for example: GIVE_FOOD_TO(bird1, birdfood)

Variable names could be anything, but im storing each variable name in std::map so later i can figure out with what animal current command is used.

When im parsing the script then i must know if user supplied either cat or bird. If i just would have cat's or bird's category then i would have only 2 lists and not a big problem to loop through either cats list or birds list and find out in what list the "cat1" is or in what particular list the "bird1" is. It would be in one or another.

But i have a lot of categories and looping through all of these lists (or std::maps) is slow and doesn't seem like a good. Just to find out in what list it's stored. I can't rely on variable names, they could be anything.

Big picture atm:

1) I have one BIG box which stores all of the categories

2) When i need to find out to which category the variable (animal_type) point's to i must get it quickly, dunno, std::map in std::map or something?

What i need basically is: I have different lists (each one is just a category for either birds or cats in this example) And when i have variable name, i must find out quickly in what particular category this item is stored. So i can work with it.

View 4 Replies View Related

Visual C++ :: Error In Finding Lowest Double In Array

Oct 25, 2014

When I run the program, when it displays the lowest temtpature, it shows the address instead of the actual number.

Code:
/*********************************************
* File: b.cpp
* Description: Create a C++ program that declares a 100-element array of doubles representing temperature readings. Pass the array to a function to be partially filled by the user. When the user is done entering temperatures, the function should return the number of elements added to the array. The main function should then display the maximum and minimum temperatures in the array.
***********************************************/

#include <iostream>
using namespace std;
//prototypes
void getData(double arr[]);

[Code] ....

View 2 Replies View Related

C++ :: How To Randomize Answer Order With Push Back

May 8, 2014

How to now randomize the answer order within this code ? I only included the relevant piece of code of the task in question.

questions.push_back(
"Question [1]"
" "
"What port does HTTPS use ? "
"1. 25 "
"2. 443 "
"3. 23 ");

answers.push_back("2");

View 3 Replies View Related

C/C++ :: Instead Of String - Accept Answer With Space In Between Words

Jun 13, 2014

string answer;
cout<<"5.Newton's which law states that F=ma?";
cin>>answer;
if (answer == "newton's second law")

[Code].....

View 6 Replies View Related

C/C++ :: Assigning Variable From Multiple Choice Answer

Oct 29, 2014

I tried to create a multiple choice list and I want to assign the value of the answer option chosen by the user so I can use it later on in the code. Later on in the code i've asked how many people (p) want a drink and multiplied it by the chosen size to calculate the price c = p * n where c is cost, n is price and p is number o of people At the bottom i tried to assign parameters where depending on what option the user has chosen n will be assigned to the chosen value...

{
printf("SELECT TYPE OF PAINT:"); /*multiple choice of paint */
printf("1. Large ");

[Code]....

View 1 Replies View Related

C++ :: Expression Creator That Prints The Work Out Too With Answer

Nov 24, 2014

I am trying to create an expression creator that prints the work out too, not just the answer.

Code:

#include <iostream>
#include <windows.h>
using namespace std;
void p1();
void p2();
void p3();
double P,P2,p,ans,ans2,ans1,restart;

[Code] .....

View 4 Replies View Related

C++ :: Check CPU / RAM USAGE / Temperature

Nov 1, 2014

I want to make an application that will check CPU/RAM USAGE and CPU TEMPERATURE and if it meets some requirements it will restart your system or do something else..but my problem is:

1) How do i get that info? (i know that in VB.net there is an easy way) but in C/C++ or Java?

2) Is it possible though a C program to execute a command and parse that info to your program?

I am mainly interested for windows but i need also info for linux too..

View 4 Replies View Related

C++ :: Displaying Celsius Temperature?

Dec 1, 2014

I am using Microsoft Visual C++ 2010 Express.

This is my Algorithm. [URL] ....

#include <iostream>
#include <iomanip>
using namespace std;
//function prototypes
int getFahrenheit();
double calcCelsius(int tempF)

[Code] ....

for some reason it keeps giving me a
Error C2144: syntax error: 'int' should be preceded by ';' on line 16 column 1
Error C2143: syntax error: missing ';' before 'return' on line 34 column 1
IntelliSence: expected a ';' on Line 34 Column 2

I have tried to fix both of these problems and no matter what I do I either get more errors or they wont go away...

View 5 Replies View Related

C++ :: Correct Answer From File - Cin Getting Wrong User Input

May 31, 2014

So I'm writing a program that will read a text file and it will do certain "functions" the text file will be like a game, and the program will be able to run many different games. The problem i'm having is in one of the "functions" i believe it's the one meant to get a correct choice from a file and a user input and put them into strings, it gets the wrong input. I know this because i tested both strings the "function" writes too. it gets the correct file answer but the user input is always "c" for some reason.

#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <stdlib.h>
using namespace std;
int progfiles() {

[Code] ....

This is the code, most likely the section that is surrounded with "///" contains the problematic "functions." This is the command Line output...investigate why they're dieing or continue on your journey?(i-investigate/c-continue) got input and answer

i
c
i
Press any key to continue . . .

The got input and answer are tests to make sure it got both, the first 'i' is my input, the 'c' is what it says my input is, and the 'i' is the correct answer from the file. this is the part of the file that the program reads to get that output

"1 Do you want to go investigate why they're dieing or continue on your journey?(i-investigate/c-continue) 2 8 i 7 3 4 You continue on picking up speed to get to the egg first.. and.. Oh No, You accidentally bumped into the walls! 2 12 5 1 You go over, and as you realize the walls are acidic and that's why the other sperm are dieing.. 2 6"

View 3 Replies View Related

C/C++ :: Exponents Solution Do Not Give Right Answer If Last Number Ends In 5

Mar 19, 2014

I have two unassigned variables A,B . My program goes as follows

#include <iostream>
#include <string>
#include <cmath>
#include <stdlib.h>  
using namespace std;    
bool die (const string & msg);  

[Code] ....

This a program that makes a calculator in which this is a small portion of it, all the exponent numbers work exceptfor anything ending in 5.

Examples go as follow 2^3=8, 3^2=9, 5^2=24

I want to why this happens, is it because they are unassigned variables?

View 1 Replies View Related

C++ :: Temperature In Celsius And Fahrenheit - No Output

Mar 8, 2013

The program should create two integer variables for the temperature in Celsius and Fahrenheit. Initialize the temperature to 100 degrees Celsius. In a loop, decrement the Celsius value and compute the corresponding temperature in Fahrenheit until the values are the same. But for some reason i either get no output or an out put of -43.

#include <iostream>
using namespace std;
int main() {
int celsius;
int fahrenheit;

fahrenheit = 0;
celsius = 100;

[Code] ....

View 1 Replies View Related

C++ :: Calculate Wind Chill Temperature

Feb 4, 2014

Here is my problem:

Wind Chill = 35.74 + 0.6215T – 35.75(V^0.16) + 0.4275T(V^0.16)

Note: Windchill Temperature is only defined for temperatures at or below 50 degrees F and wind speeds above 3 mph. Bright sunshine may increase the wind chill temperature by 10 to 18 degrees F.

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;
double windChillFactor (const double &v, const double &t)

[Code] ....

View 3 Replies View Related

C/C++ :: Take Temperature In Fahrenheit And Convert It Into Centigrade

Feb 10, 2015

I am trying to write a program where i take temperature in Fahrenheit and convert it into centigrade. I keep getting this error "The program '[5980] lab3.exe: Native' has exited with code 0 (0x0)."

My Code is :

#include <iostream>
using namespace std;
int main() {
double fahrenheit, centigrade;
cout << "Enter the temperature in Fahrenheit: ";
cin >> fahrenheit;
centigrade = (5/9)(fahrenheit-32);
cout << "The Temperature in Centigrade is " << centigrade << endl;
return 0;
}

View 4 Replies View Related

C++ :: Program Compiles Successfully But Calculations Give Wrong Answer

Feb 11, 2013

I'm using MSVC++ and it builds sucessfully but somewhere something is obviously messed it. Once i try to debug it just shows weird numbers.

int k=0; //could this be the problem??? since 0 would be over writing any given value. but if i leave int k; it showsa warning and MSVC would count that as an error

#include "stdafx.h" //Header file section
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
//structure declaration
struct menuitemtype

[Code] ......

View 14 Replies View Related

C++ :: Math Tutor - Guess Correct Answer Of Random Numbers

Jul 11, 2014

Objective: Guess the correct answer of the random numbers

Problem: I guess the correct answer but the program keeps telling me that I'm INCORRECT.

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
using namespace std;
int main(int argc, const char * argv[]) {
const int MIN_VALUE = 1; // Constants
const int MAX_VALUE = 200;

[Code] ....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved