C++ :: Does Pointer Keep Track Of Time Stamps When It Is Created

Oct 14, 2013

does a pointer keep track of time stamps when it is created? i am trying to use it to create a table that can store the access count and the temporal locality at the same time.

View 5 Replies


ADVERTISEMENT

Visual C++ :: Extracting Time Stamps From PDF?

Apr 26, 2013

I am trying to automatically extract all time stamps in a pdf file. These are typically in a line like:

when="2010-07-30T15:20:30+04:00"

For this I was thinking of using CStdioFile and the ReadString function. Somehow this doesn't work. My example code is below. Is this because pdf is not a true text file, because strings read can be longer than some max,...? Any quick way of reading the file and extracting the desired text between the brackets?

Code:
CStdioFile InputFile;
if (InputFile.Open(FileName,CFile::modeRead)) {

[Code]....

View 14 Replies View Related

C/C++ :: Same Random Numbers Being Created Every Time Loop Goes Around

May 20, 2013

one of my project involves loop inside loops and creating random numbers. Here is what I have so far:#include <iostream>

#include <string>
#include <cstdlib>
#include <ctime>

[Code]....

so the program will create a random value for the inflow. The idea is that the internal for loop will continue to run until the fill_level of the reservoir, which starts at 0, hits the capacity. The process of simulating how many years (each iteration of the internal for loop representing a year) is to be repeated 10 times by the parent for loop of the water_level simulation for loop.

The problem is that the random number that is supposed to created are the same number. THey are different every time I run it, but they are the same every time the loops repeat to make a new simulation.

View 3 Replies View Related

C :: Keep Track Of Size Of Blocks Of Memory That A Pointer Points To - Malloc Is Stuck On 8

Jan 8, 2014

I'm trying to keep track of the size of blocks of memory that a pointer points to. No matter what I do, this code below always outputs the integer 8.

If I change 1000 to 5, I still get 8. If I change it to 0, I get 8... If I change it to -1, I get 8. If I change int *a to double *a, I get 8. If I take away the & symbol, I get 8. If I use *& instead, I get 8.

Why? I want it to output 1000. If I change that to 500, I want it to output 500.

int *a;
a = malloc(1000 * sizeof(int));

int j = sizeof(&a);
printf("%d", j);

I want to build my skills where I can allocate, inspect and change memory sizes.

View 4 Replies View Related

C :: Error Reading Track From ID3V1 Tag

Feb 7, 2015

I am currently trying to read information from an ID3V1.1 tag in C. For this project we are not allowed to use any external libraries. All of the fields except for the track field read correctly. The last two lines are the ones giving me trouble. Whenever I run the program, I get a seg fault when it tries to get the track number. I tried to debug using gdb and it said the problem was happening on line 34 which is where the fseek is. It works for the other fields so I'm wondering why it is going wrong. Should I change the offset to something other than -128? But the whole tag is only 128 characters so I'm unsure what is going wrong.

Code:

Program received signal SIGSEGV,
Segmentation fault.0x00000034ff66edf1 in fseek() from / lib64 /
libc.so .6 Missing separate debuginfos,
use:debuginfo - install glibc - 2.12 - 1.132.el6_5 .3.x86_64(gdb) back
#0 0x00000034ff66edf1 in fseek () from /lib64/libc.so.6
#1 0x000000000040076f in main (argc=1, argv=0x7fffffffdf58) at id3tagEd.c:34 Code: Code: #include<stdio.h>
#include<string.h>
}

[code]...

View 2 Replies View Related

C# :: Creating Object That Uses Numeric Up / Down And Track Bar?

Nov 19, 2013

I want to create an object that uses visual C#'s Numeric Up/Down and a Track bar.

The reason is that I have a GUI that uses lots of these linked together with events and I want a common event handler for all of them.

Maybe just adding a property that is a Numeric Up/Down in the Track bar and vice-versa will allow me to create a common event for all of these pairs.

View 1 Replies View Related

C/C++ :: How To Keep Track Of Used Letters In Hangman Game

Oct 1, 2014

i am trying to make a hangman game. The game works fine so far but i cannot seem to keep track of the letters used. I have to prevent the user from using a letter that has already been entered by the user at some point in the game before. But can't seem to work my way around it. I have included the code below

#include<iostream>
#include<cstring>
#include<cstdlib>
#include<ctime>

[Code].....

View 3 Replies View Related

C++ :: How To Make A Loop That Keeps Track Of Whose Turn It Is And Their Score

Dec 11, 2013

[URL] ....

This is my code, but how can I implement this?

View 1 Replies View Related

C# :: Persist Object To Track User Access?

Feb 19, 2014

I would like to track user actions within my windows desktop application, and write them to a database.

I also have a User class, that has a userID field pulled from the User table. I can write a login event (UserID, timestamp, action) with no problem, but as the user navigates around the app, how can I persist the user object so I always have access to their userID? I know I can just pass it as a parameter as they do different tasks, but that seems inefficient to me.

View 7 Replies View Related

C++ :: Sort N-dimension Point And Keep Track Of Original Index?

May 4, 2013

I have a set of n- dimension point store in `vector< vector<double> >`

ex A[0][1].............[N], and A[0][0] = X, A[0][1] = Y, A[0][2] = Z

and I want to sort the vector of all of the dimension

ex sort X, Y, Z ,.........N in ascending order

ex A[0] = (1,5,3), A[1] = (3,2,1) A[2] = (2,8,4) after sorting
index: 0 1 2
A[0] = (1,5,3), A[1] = (2,8,4) A[2] = (3,2,1)
original index : 0 2 1

I find that `sort(vector.begin(), vector.end())` can sort it but how can I record the original index with a additional vector?

Is there a algorithm or C++ feature can solve it?

I have tried to solve it with a class wrapper it but I don't know how to write the compare function.

class point{
public:
point(int totalLength = 0, int elementLength = 0);
vector<vector<double> > pointSet;//store the n-D points
vector<double> pointIndex;//store the index
};
point::point(int totalLength, int elementLength){
pointSet.resize(totalLength,vector<double>(elementLength, 0));
pointIndex.resize(elementLength);
}

View 3 Replies View Related

C++ :: Program That Keeps Track Of Social Security Numbers Of Customers

Jun 27, 2013

I am trying to write a program that keeps track of social security numbers of customers I have to assume that its a four-digit number. When the program runs,it has to prompt that the user should enter a 4-digit number to record, or 0 to exit.

The program also needs to be able to give an error message if a certain number is entered more than once.

After all the numbers have been saved and you finally end it by pressing 0, it needs to be able to output all the entered SSN's.

Here is my code so far:

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
bool isExist(int ssn, int records[], int numberOfRecords);

[Code] ......

View 3 Replies View Related

C++ :: Program To Keep Track Of Social Security Numbers Of Customers Of A Bank

Oct 4, 2014

In this assignment, you are going to write a program that keeps track of the social security numbers (SSN) of customers of a bank. Please notice that we are going to assume that SSN is a four-digit number (e.g., 1234. 0123 is not allowed.). When the program runs, it prompts that the user should enter a 4-digit SSN number to record, or 0 (zero) to exit.

So far I have this:

#include <iostream>
using namespace std;
bool isExist(int ssn, int records[], int numberOfRecords);
int main(){
int ssn = 0;
int records[32];

[Code] .....

View 16 Replies View Related

C/C++ :: Dice Rolling - Keeping Track Of How Many Times A Number Appears?

Sep 27, 2014

I wrote a code that mimics a dice, my code so far will ask for the user to input a number at which they want to hold or no longer throw the dice, it will also ask the user how many roll simulations they would like to do.

If a 1 is rolled the turn is over and the score is 0

After this input is recieved the code goes into a loop until the values have been met.

I would to add probability to my code so I need to know how many times a certain number was rolled and this is where I am stuck.

An example of how I would like my code to work, let's suppose hold at number is 17

We role the dice until we roll a 17 or larger, but if we roll a 1, then our score is 0.

Let's suppose the number of simulations is 5 and for simulation 1 we roll

2 + 5 + 6 + 4 = 17

and for simulation 2 we roll

5 + 4 + 1, but since we rolled a 1, the score is 0,

for simulation 3 we roll

3 + 4 + 5 + 6 = 18

for simulation 4 we roll

4 + 4 + 6 + 6 = 20

for simulation 5 we roll

3 + 4 + 5 + 5 = 17 so that means we got

0: 1 time 1/5 = .20
17: 2 times 2/5 = .40
18: 1 time 1/5 = .20
19: 0 times 0/5 = .00
20: 1 time 1/5 = .20
21: 0 times 0/5 = .00
22: 0 times 0/5 = .00

In other words the idea is to roll a 17 or larger (or whatever the hold number happens to be), but if you roll a 1, then your score is a 0.

#include <iostream>
#include <cstdlib>
#include <ctime>
using std::cout;
using std::cin;
using std::endl;
int dieRoll();

[Code] ....

View 4 Replies View Related

Visual C++ :: Keep Track Of Social Security Numbers (SSN) Of Customers Of Bank

Jun 26, 2013

I am trying to write a program that keeps track of social security numbers (SSN) of customers of a bank. I have to assume that SSN is a four-digit number (e.g., 1234. 0123 is not allowed.). When the program runs,it has to prompt that the user should enter a 4-digit SSN number to record, or 0 (zero) to exit.

The program also needs to be able to give an error message if a certain number is entered more than once.

After all the numbers have been saved and you finally end it by pressing 0, it needs to be able to output all the entered SSN's.

Here is my code so far :

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
bool isExist(int ssn, int records[], int numberOfRecords);
void listRecords(int records[], int numberOfRecords);
int main()

[Code]...

View 2 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++ :: File Created But Empty

Jul 22, 2013

A file is created but its empty. And when I first create an entry and then display all the entries, it does nothing.

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

class comp {

[Code] ....

View 2 Replies View Related

C++ :: Use 3D Graphics Obj Files Created With UDK?

Jan 6, 2013

How do I use 3D graphics .obj files created with UDK in a C++ project?

View 1 Replies View Related

C++ :: Processing Buttons Created At Runtime

Oct 7, 2014

I am developing a small game using MFC in which the game options like new game, save, open, exit etc. can be selected from the menu as well as from the buttons inside the window. I have no problems with the menu but the buttons do not seem to work at all.

The buttons are created at runtime using CButton class. To associate the buttons with the corresponding functions, I just used the same resource ID for the buttons as the menu options, but that did not work. When I click on the buttons, nothing happens. If I assign different resource IDs to the buttons, how do I handle the message map entries? Do I have to write different message map entries for the menus and the buttons while their function is exactly the same?

View 6 Replies View Related

C++ :: Size Of Dynamically Created Array

Dec 2, 2013

I have declared an array like:

/***********Creating an m*p array**********************/
B = new int *[m];

for(row=0;row<m;++row)
B[row] = new int[p];

How to find the number of elements in it?

The statement

cout << "number of elements in array B equals " << sizeof(B) << endl;

returns 4 each time the program runs

View 3 Replies View Related

C++ :: Arrays Are Actually Created With A Size Indication?

Jan 14, 2014

Reading Effective C++ by Scott Meyers, and Item 16 claims that when an array is created, the compiler reserves a block of memory at the very beginning to indicate how many objects are in the array.

n = number of objects
|n|index0|index1|...etc

Scott Meyers wrote:This is just an example, of course. Compilers aren't required to implement things this way, though many do.

Supposedly, this how delete knows how many objects to destruct. And if you were to do something like:

int* foo = new int;
//Stuff
delete[] foo;

Then delete would interpret the first block as the number of items to destruct, then continue on and destruct that many blocks of memory onward, causing UD behavior.

Is there any truth to this?

View 1 Replies View Related

C++ :: Text Based RPG - Object Not Being Created?

Oct 24, 2013

I'm currently creating a text-based RPG, to get myself back into learning C++ again. The problem seems to be with the if-else ladder of statements, the user selects which race they wish to play as, which as a result creates the appropriate object for that race.

This is the character selection option code:

std::cout << "Please select a race: Human [1], Elf [2], Dwarf [3] or Orc [4]
";
std::cout << "Race selection: ";
std::cin >> race_selection;
std::cin.ignore();
switch (race_selection) {

[Code] .....

The problem here is, regardless of which race I use using the above switch statement, the Human object always seems to be created, instead of the object for the desired race.

View 4 Replies View Related

C++ :: How Many Bits Are Created By Unsigned Exponent

Nov 21, 2013

i want to ask how many bits are created when write this line

unsigned exponent:10;

is exponent locate a 10 byte from memory or 10 bits ?

View 1 Replies View Related

C/C++ :: Make Class That Can Only Have One Object Of It Created?

Oct 7, 2014

make a class that you can make only one Object of it.

For example if you have Class A.
Let's say you create one object A* a=new A();

Now the next time you, try to create another object. For example:

A* b=new A(); What will happen is that b will get the same object (or reference) as a. In other words hey'll be pointing towards the same place. So basically you'll only have one object of it created. I tried doing it but I couldn't quite make it.

Here is what I tried: (but couldn't complete the exercise)

class God
{
public:
static int num;
static God* god;

[Code]....

View 2 Replies View Related

Visual C++ :: How To Sort Combobox After It Has Been Created

Feb 1, 2013

I have a combobox which doesn't have the CBS_SORT style and after adding some items I'd like to offer the ability for the user to sort it alphabetically by clicking on a given button. How can I sort the combobx after it has been created and some items added to it ?

View 4 Replies View Related

C# :: Created A Simple Basic Program That Uses Sockets

Feb 22, 2012

I have created a simple basic program that uses sockets but it can only handle one connection, how do I make it so it handles multiple connections?

Server code:

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
}

[code]...

View 5 Replies View Related

C++ ::  passing 2D Array Created Using Vector Container

Feb 10, 2014

I am trying to pass a 2D array called f (coming from a text file with 9 columns of numbers and 297,680 rows) that was created using the vector container in my main() to the function myfunc. I'm just trying to figure out how to pass the address of f in main() to myfunc(), so that myfunc() has arguments consisting of a pointer g (that accepts the address of f as an input) and an int.

This is the error from the compiler:
test_2d.cc: In function ‘int main()’:
test_2d.cc:47:25: error: cannot convert ‘std::vector<std::vector<double> >*’ to ‘double (*)[297680][9]’ for argument ‘1’ to ‘int myfunc(double (*)[297680][9], int)’
return myfunc(&f,count);
^
Here is my code:

#include <iostream>
#include <fstream>
#include <iomanip> //allow setprecision to get all the decimal points
#include <vector>
#include <string>

[Code] ...

View 5 Replies View Related







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