C++ :: How To Make A Long Time Periods If / While Statement

Feb 8, 2014

I'm making a program that would run 24/7 and that could be run on multiple computers that are all running Windows (the program would be in the startup folder of the computer).

So I'm searching for 2 functions, one that would check if the program has been already launched on this computer and another one that would do a save every 24 hours. but for the second one I don't know what I should do because I think that a loop with sleep() would take too much power for the cpu

View 7 Replies


ADVERTISEMENT

Visual C++ :: Long Time Button Pressed Event - MFC

Feb 2, 2015

I Like to Open a Dialog When the Button Was Pressed for 5 seconds Continuously.

I'm using Windows 8 HP Tablet, Is MouseUp & MouseDown events suitable for this requirement.

View 12 Replies View Related

C :: Reading Three Digits At A Time As One Number In Long String Of Numbers

Nov 29, 2013

How can I read a file that contains numbers only, but read it by three digits at a time? I have a long string of numbers and every three digits corresponds to a particular number in itself. i.e. a string of 064045154 would need to be read as '064' '045' and '154'. I need to then subtract one from each of these numbers and the new values I need to convert into their ASCII characters and place these in a new file. This is what I have (focusing on the 'Decrypt' function) but all it does is in the new file place a string of the same character repeated over and over a total number of times equal to the number of integers in the numbers file.

Code:

#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "limits.h"
int Encrypt(char * FILENAME)

[Code]..

View 1 Replies View Related

C++ :: How To Reverse Nibble In A Long Long Int Variable

Apr 1, 2015

I have a long long int k=0x0000888804eaad0e

And i need the reverse of this (nibble wise) in other long long int variable.

That is i want the result to be = q=0x0000e0daae408888;

Or the result also can be like this = q=0xe0daae4088880000;

How to accomplish the above?

View 4 Replies View Related

C/C++ :: How To Make Switch Statement Work

Feb 26, 2014

The program i am trying to make is for practice of using switch. the idea is the user enters a number and the program will print a day of the week corresponding to said number.

the statement is not complete with all cases yet, but i dont want to write all of it until i am sure of it being correct.

errors when compiling (gcc) are as follows

1 warning and 3 errors generated.
Robins-MacBook-Air:array2 RDenton$ gcc array2.c
array2.c:26:9: warning: format string is not a string literal
(potentially insecure) [-Wformat-security]
printf(a[uservalue]);

[code]....

View 3 Replies View Related

C++ :: Tic Tac Toe Console Game - If Statement Does Not Make Correct Decision

Feb 18, 2015

I recently wrote a "Tic Tac Toe" console game, and i seem to have a problem in my winning conditions, as when it checks if the player won (should have won) it doesn't take the appropriate action.

The winning conditions are in CoreLogic.cpp

here's the code, might not be the most pretty and clean code ever but it works for me.

there are more files i just didn't feel the need to include them all since the problem is only within CoreLogic.cpp and possibly in main.cpp

pos1-pos9 have been declared in the UserInterface.cpp and are being used to determine the correct decision to do within CoreLogic.cpp

Nothing happens when you win at this point it just exits the program.

View 19 Replies View Related

C++ :: How To Make Program That Presses Key After Certain Amount Of Time

Mar 9, 2013

Say I want to leave a program running and it stops when I press F9 for instance, I'm looking for something like (and note this is just a generalization).

#include blah
using namespace std;
/wait 2 hours
/key.press = F9
return 0;

View 5 Replies View Related

C :: Srand Function Make New Numbers Every Time On Calling

Mar 6, 2015

How do i make the srand() function make new numbers every time i call it? Now it seems like it repeats its result over an over again.

Below is a program that should generate random numbers for 3 dices and print these out. But it prints out the same nr over and over.

Code:
#include <stdio.h>
#define MAX 100
int filler(int dice1[MAX], int dice2[MAX], int dice3[MAX]) {
int throws, nr;
printf("Define the number of throws");
scanf("%d", &kast);

[Code] .....

View 6 Replies View Related

C/C++ :: Round Robin Execution With Gantt Chart - Arrival Time And Burst Time

Mar 10, 2015

This is a round robin execution. with gantt chart. arrival time and burst time. I think there is an error in my formula to get the right answer,i cant resolve it but my program is running. What is the code or the right formula??

#include<stdio.h>
int main(){
int i,j=0,n,time,remain,flag=0,ts;
int sum_wait=0,sum_turnaround=0,at[10],bt[10],rt[10];
int ganttP[50],ganttStartTime[50];
printf("Enter no of Processes : ");
scanf("%d",&n);
remain=n;

[Code] ....

View 2 Replies View Related

C++ :: Transfer If-else Statement Into Switch Statement?

Sep 7, 2013

How to make if else code below into SWITCH STATEMENT?

cout << "Enter the temperature: ";
cin >> temp;
cout << "Enter the pressure: ";
cin >> pressure;
cout <<endl;

[Code]....

View 6 Replies View Related

C++ :: Passwords Must Be At Least 7 Characters Long

Dec 4, 2013

I've written a code that request for a password and its suppose to look like this.

Sample Output (inputs in bold)
Please enter a password: pass6
Passwords must be at least 7 characters long
Please enter a password: TarrantNW
Passwords must include a digit or dollar sign (0-9, $)
Please enter a password: Tccd-03

But when I run the program it stops at "Passwords must be at least 7 characters long" and the box closes and where I should put the loop=

#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;
const int SIZE = 7;
char password[SIZE + 1];

[code]....

View 3 Replies View Related

C++ :: Define Long Variable And XOR

Aug 15, 2013

I want to write encryption algorithm.first af all I need to define variable( binary input ) that it is 256 bit but I dont know what should I use...then I want to XOR this to variable ( a & b ) ( each of them is 256 bit)

View 6 Replies View Related

C++ :: Why The String Provided For Initialization Is Too Long

May 9, 2014

I'm not understanding why the string provided for initialization is too long?

Code:

int main()
{
char array[1] = "A";
return 0;
}

View 6 Replies View Related

C :: Convert A Long Int Into Char Array?

Feb 21, 2013

Without lossing information?

View 14 Replies View Related

C++ :: Converting String Into A Long Double

Mar 11, 2013

I have a problem with converting a C++ string into a long double. In order to do this, I used the function strtold, but the result I get is only the integral part, that is: if for example the input string is 12.476, I only get 12 as the converted long double value. This happens with atof too.

Here is my code:

#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <sstream>
string test = "12.345";
long double test_longd = strtold(test.c_str(),NULL);

[Code] .....

View 3 Replies View Related

C++ :: Integer Max - Long Data Type

Jan 4, 2013

Working on a Project Euler problem and the question asks for the largest prime number that is a factor of 600851475143. As you can see, this is significantly larger than the maximum of a long data type, which maxes out at 2147483647.

I'm running on Windows 32, so int64 is not a valid option for me. It seems like I'll likely have to use a different language to solve this problem.

View 4 Replies View Related

C/C++ :: Converting String To Long And Then To Double

Jun 15, 2014

So I have problem with my code, I'm trying to convert string to long and then string to double, but I get this when I compile it:

terminating with uncaught exception of type std::invalid_argument: stod: no conversion

I was thinking if there is a way to do this without using (stol) or (stod)

Market::Market(string filename)
{
string line, word, date, stockprice;
long realdate;

[Code].....

View 14 Replies View Related

C# :: Regex / Getting Integer As Long As Its Not In Quotes

May 9, 2014

I am trying to highlight integers in a textbox.

The problem, is that I dont know how to make Regex get Integers no matter what (e.g. even if an =, >,<,>=,<= sign is in front or anything) unless it is encased in a string e.g. "'s or whatever.

My current code does this:

I do not want the numbers to be highlighted if they are in a string.

View 6 Replies View Related

C++ :: Long Double Datatype - Output Always 0

Nov 11, 2014

My code:

#include<cstdio>
#include<iostream>
using namespace std;
main() {
long double j;
scanf("%Lf", &j);
cout<< j;
return 0;
}

If I give any number as input, the output is always 0. why? where's the problem ? p

View 6 Replies View Related

C++ :: Selection Of Interesting Point From Long List

Mar 29, 2013

I have some codes which are not efficient enough to get the answer faster.

Q: Tom is looking for a car with high miles per gallon and high horse power.For example:P1--Toyota with MPG=51,HP=134, the P2--Honda with MPG=40,HP=110, P3--Ford Fusion with MPG=41,HP=191,P4--Nissan with MPG=35,HP=195,P5--Volkswagen with MPG=30,HP=140

Since,p2 is worse than p1(in terms of MPG,HP) and p5 worse than p4(MPG,HP), thus they are cancelled. The leftover 3 cars are considered interesting cars.Tom wish to find all interesting cars from the list but there's too many of them. Thus write a program to find this list as fast as possible.(C++)

int SimpleAlgo2 (int &n, int &d, vector< vector<float> > &point) {
vector<bool> isBest(n+10, true);
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {

// We will check if point[i] is strictly worse than point[j]
// no need to check if we already know that point[i] is not the best
if (isBest[i]) {

[Code] ....

View 3 Replies View Related

C++ :: How To Display Words Splitted From A Long Sentence

Apr 8, 2013

How can i display words form a long sentence.

example :(lets assume that if u find two spaces that is word)

INPUT: the Indian school boys are very good compare to other countries.

OUTPUT: the Indian
school boys
are
very
good
compare to
other countries

I am solving these way but it takes only one space to divide a word.

#include <string>
#include <vector>
#include <fstream>
#include <iostream>
int main() {
std::vector <std::string> words;

[code] .....

View 1 Replies View Related

C++ :: Long Decimal Integer - How To Implement Constructor

May 4, 2014

I am trying to print out 2^1000. I am not entirely sure on how to implement the constructor. I currently just have x.push_back(n) as my constructors implementation. For the function double(), it is suppose print 2^10 as 1024 and the function addDigits() should print 2^10 as 7. Am I suppose to create a Long object with 2 as a parameter and then use double() to double it 10 times?

#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
class Long {

[Code] .....

View 6 Replies View Related

C Sharp :: Type Cast Array From Int To Long

Aug 1, 2012

my array contains elements of integer type

how can i convert my array to long array

View 1 Replies View Related

C Sharp :: Why Windows Service Get Hang After Long Run

Nov 7, 2012

I have written a windows service which run continuously on a server. Interval time is 9 sec. On timer1_interval i am fecthing record from database and sending it to user. And changing its record status.

this service stop fetching records after running 4 to 5 days. We need to restart the service. there is no GUI involve in this code

View 1 Replies View Related

C++ :: How To Use Time For Time Based Movement

May 1, 2013

So I'm trying to learn how to use time for time based movement and what not. I did this only knowing the command time(&variable)

time_t timer;
int I, X;
void main() {
time(&timer);
X=timer;
while(I==5) {

[Code] ......

There's probably some other better way to do it... Obviously but for now I see it as putting current time in X.

start while
take in time constantly until I is 5
constantly asking is time>X(preset time 5 seconds ahead)
if it is
display message and add one to I

Why doesn't this display my message after 5 seconds?

View 1 Replies View Related

C :: Program That Multiply Very Large Numbers (out Of Range Of Long Int)

Jan 10, 2014

I have to write a program, that multplicates very large numbers (out of range of long int). It's said that i need to use arrays and read the numbers as strings. My problem is to end function called "mnoz:, because i don't know how to sum the multiplicated values of arrays a and b.

Code:
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include "winbgi2.h"
#include<string.h>
#define roz 10000
char lan(char a[])

[Code] ......

View 1 Replies View Related







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