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
ADVERTISEMENT
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
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
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
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
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
Dec 27, 2013
I was exploring static variable by writing code snippets. I tried below code and it ended up throwing error saying "error: storage class specified for parameter 'b'"
Why static cannot be used in func() ?
Code:
int main() {
int a;
a=5;
func(a);
printf("%d",a);
return 0; }
void func(static int b)
{b=6;
printf("%d",b); }
View 7 Replies
View Related
Sep 19, 2014
Now i am utilizing vectors in my codes.If i want to make a vector and i use #define to put a limit on the amount of variables it can contain. Until now i can do that. But let's suppose that i put 40 variables as its max capacity, but an user just needs to use only 12 or 14 variables. Put a rule that if someone has finished inserting his data and he is yet to fill the whole capacity of the vector the code.As to say : "If case you want to end press 0" .Edited : My computer has windows 7 and i took Codeblocks as my editor.
View 2 Replies
View Related
Jul 15, 2012
I am working on a parallel processing server/client app with a multi-threaded server and several data processing clients, each their own process. I am trying to optimize some of the parameters, such as the size of the chunks that are read, processed, and output, and also some of the timeout values and such. I can track the time to finish a given task well enough, but it would be really nice to be able to track the cpu use. When CPU use is near 100% (on all cores) for the entire run, that is a good sign. I have noticed that with some combinations of parameters, CPU drops quite a bit for long stretches, which is not such a good sign. This app process large input files (2.5GB-65GB so far) and needs to be stable for long periods of time.
Other than sitting and staring at the task manager all day, is there a good way to track/log the CPU usage over runs that take many hours? I know that there are some apps like Everest that chart CPU use, but it would be nice to have something that would write to the same log file I am already using for other program output.
View 1 Replies
View Related
Nov 26, 2013
I've been doing some practice programming challenges and I am currently making a temperature converter from Imperial to Metric.
My approach was to make it as simple as possible but it must display correctly and use decent I/O manipulations corresponding with how high the counter is.
This is what I have come up with, and everything seems to work fine for a base where I could possibly add more code to include user input, but before I go to that one step further I'd just like to know if the approaches I have taken to using iomanip is OK practice and I haven't done any serious no-nos, as I haven't seen any code from example videos that people make that includes this!
Here's the code:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
[Code] ....
The reason I added the IO manipulators is because I couldn't stand seeing everything not lining up, it looked very sloppy and unprofessional..
View 2 Replies
View Related
Nov 13, 2014
I'm trying to make a simple temperature converter with a menu that lets users pick which conversion to perform. But, it won't seem to print the right conversion. It just prints the same temperature that I inputted.
for example:
#include <iostream>
using namespace std;
//prints the menu
void userMenu(){
cout << "Temperature Calculator" << endl << endl;
[Code] .....
View 2 Replies
View Related
Dec 31, 2014
I am given two month's data (Max, Min, Ave) for every day in that month.
The task is to display all 3 of that data for any selected day in that 2 months.
View 3 Replies
View Related
Jan 20, 2015
What I have to write in "int main" to get 1.room list 2.every room temperature, humidity and heat index 3.and how to increase or decrease every parameter
#include <iostream>
#include <string>
using namespace std;
struct Klinikos //hospital {
string Patalpos; //room
float Temperatura; //temperature
float Dregme; //humidity
bool moreTemp;
float KarscioIndeksas; //heatindex
[Code] .....
View 7 Replies
View Related
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
View Related
Feb 20, 2015
I don't use Visual Studio and/or C++ so I would like to do it without them. I found this article c++ - How to determine CPU and memory consumption from inside a process? - Stack Overflow
I tried some lines of code but no one works for me.
Code:
#include "windows.h"
typedef struct _MEMORYSTATUSEX {
DWORD dwLength;
[Code]....
These was just my first tries to work with da MEMORYSTATUSEX.
I would like to find out if there is free memory at least ... (some value) and similar.
View 1 Replies
View Related
Jan 27, 2013
How can I check how much memory my program is using? I have an assignment which asks me to make sure I'm not exceeding some amount of memory but I don't know how I'd do that on Windows 7.
Also, my program parses through a text file and puts each word in a vector so that I can later go through the vector and "locate" where the nth occurrence of a word is by keeping track of a counter and incrementing the counter each time I see the word in the vector. Is this a vector a bad data structure for this? I'm aiming at keeping the efficiency at less than O(n^2).
View 9 Replies
View Related
Apr 21, 2013
I use Visual C++ to write a native C++ application. How to know the maximum memory it will use during its execution?
View 5 Replies
View Related
Dec 11, 2012
I am using a thread in my application .. A DLL is written for In and Out instructions for hardware ICS and to read FIFO.
My code is
CCriticalSection crdll , crsec ;
UINT ThreadReceiveData(LPVOID param) {
for ( ; ; ) {
if (bTerminate) break; // bTerminate = 1 in Doc template destructor
crdll.Lock();
[Code] ....
I am confused , how and when I should use Ctitical Section ? The program works fine but I am not happy as this is main routine of the program and I have not understood it properly.
View 10 Replies
View Related
Feb 1, 2015
How would you be able to show both outputs celsius and Fahrenheit and my temperature conversion is coming up wrong when i enter in the input. here is my code...
#include<iostream>
using namespace std;
int main(){
double celsius;
double fahrenheit;
[code].....
View 1 Replies
View Related
Feb 12, 2015
Write a program that creates and displays a table of temperature conversions. Get the starting temperature from the keyboard in degrees Celsius (do not allow input of a value below absolute zero). Also get an integer value to represent the number of degrees to increment for each of a 20 row table (do not allow the increment value to be less than one. The first column will be a row number starting with one, follow by the Celsius value and then the conversions into Fahrenheit, Kelvin, and Rankine. Be sure that all columns are neatly right aligned for a variety of inputs.
Thats what i wrote so far:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
double C,F,K,R,n,a;
cout <<"Enter starting temperature in Celsius: ";
cin >> C;
[Code] ....
Thats what the instructor looking for:
Enter starting temperature in Celsius: -500
ERROR: Temp must be >= -273.15: -273.15
Enter increments in degrees Celsius: 100
# Cels Fahr Kelv Rank
1 -273.15 -459.67 0.00 0.00
2 -173.15 -279.67 100.00 180.00
3 -73.15 -99.67 200.00 360.00
4 26.85 80.33 300.00 540.00
5 126.85 260.33 400.00 720.00
6 226.85 440.33 500.00 900.00
7 326.85 620.33 600.00 1080.00
8 426.85 800.33 700.00 1260.00
9 526.85 980.33 800.00 1440.00
10 626.85 1160.33 900.00 1620.00
11 726.85 1340.33 1000.00 1800.00
12 826.85 1520.33 1100.00 1980.00
13 926.85 1700.33 1200.00 2160.00
14 1026.85 1880.33 1300.00 2340.00
15 1126.85 2060.33 1400.00 2520.00
16 1226.85 2240.33 1500.00 2700.00
17 1326.85 2420.33 1600.00 2880.00
18 1426.85 2600.33 1700.00 3060.00
19 1526.85 2780.33 1800.00 3240.00
20 1626.85 2960.33 1900.00 3420.00
Press any key to continue . . .
My question is to know how to make the sequence from 1 to 20 and whats the best statement for increment...
View 2 Replies
View Related
May 12, 2013
Full disclosure: this is an exercise from "Sams Teach Yourself C++ in 24 Hours" by Jesse Liberty and Rogers Candenhead. This refers to Chapter 9 (Hour 9 Activity 1)
I created a class called Point, in Point.h
I created a class called Rectangle in Rectangle.h and Rectangle.cpp
If I create an int main() function in Rectangle.cpp (that includes Rectangle.h), I can compile Rectangle.cpp and run the resulting program. Fine.
Question:
I create a separate file called main.cpp. I include Rectangle.h. But now the compiler complains.
Code:
$ g++ main.cpp -o main
/tmp/cc38JIph.o: In function `main':
main.cpp:(.text+0x26): undefined reference to `Rectangle::Rectangle(int, int, int, int)'
main.cpp:(.text+0x32): undefined reference to `Rectangle::getArea() const'
collect2: ld returned 1 exit status If I can create a class in Point.h and use it in Rectangle.h, why can I not just use Rectangle in main.cpp?
And the files, of course:
file: main.cpp
Code:
#include <iostream>
#include "Rectangle.h"
using std::cout;
using std::endl;
[Code] .....
View 3 Replies
View Related
Apr 27, 2013
I am doing a project for a class which involves making a game where there is an arrray that holds a player (you) and a zombie (comp). The player is suppose to be able to turn clockwise or counter clockwise, move forward, and backward and shoot. Im having trouble trying to rotate the char in an array. I am also trying to switch from using the W,S,D,A to the arrow keys but doesnt seem to work.
#include <iostream>
#include <windows.h>
#include "color.h"
using namespace std;
using namespace Petter;
const int COL = 15;
void initBoard(char[][COL], int, int);
[Code] ....
View 5 Replies
View Related
Dec 23, 2014
I basically have a listbox that has postcode areas i.e : AE,CW,GU etc etc.
The user selects this and then a postback occurs - an sql statement is builts and a database query operation is performed and the results are returned to a datatable called tempdata.
So far so good. I then need to loop through this datatable and copy the records to my main viewstate datatable which is the datasource for google maps api.
DataTable tempstore = GetData(querystring, "");
//check tempstore has rows otherwise add defaultcust as default otherwise map will be blank
if (tempstore.Rows.Count == 0)
{
[Code].....
So my main datatable can grow and grow as users add more postcodes. However when it gets to around 500 rows or so I get a huge memory spike only on postback and then it settles back down.
My ram usage goes from 2gb to 3gb and if even more postcodes is selected it maxes the memory and crashes my pc.
If I remove the:
dtpc.Importrow(row);
the memory spike goes completely, obviously because the main datatable has no rows. I thought you only run into memory issues when you have thousands of rows?
View 1 Replies
View Related
Apr 10, 2014
I am wondering why ToStr throws me this error. I am using mingw64 and codeblocks.
Code:
E:JackyDocumentsCode Blocks ProjectsPerfectSimXmain.cpp|35|undefined reference to `std::string ToStr<int>(int const&)'|
Code:
for (int i = 0; i < NO_CAMS; i++) {
std::string filename("E:/Jacky/Documents/Code Blocks Projects/PerfectSimX/Data/Cam");
std::string restFileName(".cam");
filename += ToStr(i);
[Code] ....
View 4 Replies
View Related
Oct 7, 2012
I am working on a project were I have to read line form ( PLC ) programmable logic controller generated text file with lines like this
Circuit Value Current 2.33 4.32 5.55
there could be up to 3000 lines per txt file
I am using string stream to parse the line, for the sake of good programming I which to check weather first three values are string and last three values are actually floats raise or throw an exception if they are not ....
View 4 Replies
View Related
Apr 20, 2014
I'm writing the program below to take an integer input for temperature and display a cheesy message for different ranges for each day of the week.
I tried using two if statements, the first to determine if the input is valid, and the else display that it was invalid and to try again.
The second set of if (if else) statements would evaluate a number input and display the cheesy message based on the value, or if it was out of range, to make you re input that days temperature.
I understand that the else statement is linked to the closest if statement, unless brackets are added to prevent this. I thought my brackets were correct, but I keep getting [Error]'else' without previous if'. The red lines are the if and else statement I'd like to be linked, and tried to do so by enclosing the 2nd if statement in brackets.
The assignment doesn't require the error checking, but if I don't use some form of it I believe it will just loop. Again I have to use the last 4 lines due to instructors rules, and have to use scanf and not strings or arrays.
This program will ask the user what the temperature will be for each day of the week. The integer input from the keyboard will be tested in a series of IF tests and a message will be printed depending on the temperature.
Code] ....
#include <stdio.h>
#define MAX 100
#define MIN 0
int main() {
int day = 1;
int temp;
[Code] ....
View 10 Replies
View Related