I have some question in regards to the b part 2. My code is working fine when the number of input is low. However when I input more larger input data to my program it start to hangs.
/* password valid if there is 1 uppercase 1 lowercase and 1 digit - problem: program hangs after first input. */ #include <stdio.h> main() { char password[200]; int i = 0; int upper = 0; int lower = 0; int number = 0;
I'm having issues trying to input data from a .txt file into my array program. The whole program takes the name, # of goals and assists, adds them together to get points, and then puts in a given + or - rating. The program works except for the data input.
Also, this is an alphabetical "Unsorted" list, but is there a way to order the list based on point value and be able to display that as well as a separate "Ordered" list?
And this is the .txt file. Order is Players Name, Goals, Assists, Plus/Minus rating. The points are added when points = goals + assists (Should be in the main coding above).
In class we were asked to create a C++ BTree program that would allow a user to input the following data types and then store said data in a .txt file:
0. ID 8 bytes
1. First name 30 char
2. Last Name 30 char
3. Street Address one 30 char
4. Street Adress two 30 char
5. City 30 char
6. State 20 char
7. Zip 10 char
8. Country 30 char
(I'm not particularly asking for full code, pseudo code would also be great). I had a great deal of my work done, unfortunately, the computer I was working on crashed, corrupting my files.
// this program gives random number output #include <iostream> #include <cstdlib>// contains function protype for rand #include <iomanip>// for setw using namespace std;
[code]....
what is the effect on output of program of different numbers input to the int data type named seed*/
I have a .txt with a 0 or 1 to each line of the txt file. there are many values to read. I am reading the values and calculating how many each reoccur in a sequence (run-length encode). If i only use say 50 values coming in it works, but once i do the hundreds there are in the file it hangs. i am not sure why.
So using InitiateSystemShutdownEx causes a Win32 machine to go log off go to the shutdown screen and just sit there displaying shutting down with the working indicator just spinning. I left the machine sitting there for an hour and it never shut down. This works fine on all the Win7 x64 machines we are using but the one 32 bit Win7 machine has this problem and it occurs no matter what parameters I pass.
Code: HANDLE hToken; TOKEN_PRIVILEGES tkp; // Get a token for this process. if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) return false ; // Get the LUID for the shutdown privilege. LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
[code]....
This is working fine on Win7 x64 but not on the one Win7 32 system we have and like I said it starts the shutdown process just never finishes.
We are using the DownloadFile method of the WebClient class to download artwork via URLs for purchase orders, this works well for the most part, but hangs with certain file types. We never have problems with .pdf files, but .ai files (Illustrator) just hang with 0 bytes being downloaded, and then eventually times out after the default 60 seconds. Any similar activity while downloading files with the WebClient class? The files that are being downloaded are hosted on the same server, in the same directory.
if (validURL == true) { WebClient client = new WebClient(); try { client.Headers.Add("Accept: text/html, application/xhtml+xml, */*");
How to write a simple function that will take 3 ints and find the sum of the higher 2? This is what i got so far:
int findsum(int a,int b,int c)// will find the highest int and return it to our main program { int max,max2;// this sets our local variable max // next we will find the larger of our first 2 variables if( a>=b) { max=a;
[Code] ....
How to get the second highest number and add it to max
Found an online suggestion of using an rc2 file and cut and paste stuff from .rc file to .rc2 file to see which line causes the problem but don't know how to create a blank .rc2 file. Problem started after I ported from VC++ 6 to VS2010.
On compilation the following program does not give any error and when i run this program then sometimes it gives the segmentation fault. Specially with the larger values. I made sure that the values i inputted are not crossing any range of data types i used. I cannot get what is making my code to give segmentation fault error.
We never got into any gui stuff. It was strictly console apps. That being said I have been able to create a few small apps. I would like to start to create GUI based apps but I am kind of overwhelmed at the choices. I dont know where to go from here. Since I have c++ experience I would think Visual C++ would be the choice but i have been reading a lot of forums and getting other info.
Is there another language I should look at the would allow me to convert my program quicker or easier?
The console program I already created is very very simple and want to make a gui for.
Quick break down.
Reads file Changes file contents based on search string, saves and closes file and kills a windows service exits
Only thing I want to add would be the ability to run the file from a remote site within the company LAN(not a priority though). Currently it needs to be run locally on the server.
I added this snippet of code to a larger project I use to read some numbers in from a file, but for some reason I'm getting a segmentation fault.
Code: printf("starting main "); FILE *cutoffs; double cut1=0, cut2=0, cut3=0; printf("trying to open file
The cutoffs.in file looks something like
Code: 3.475 3.875 4.025
I ran the gdb debugger, so I know it is occurring at that fscanf; however, it doesn't give any other details (to be honest I don't have much experience with debuggers :x) ..The values are being put into an array. Before I just had numbers initialized in the array by hand, but need to have 20 different runs of this code with different numbers each time...
I am trying to understand what techiques can be used to sort really huge files (larger than available memory). I did some googling and came across one technique.
1. Are there any better ways to get this done?
2. Is there some tweaking that can be done to make this itself better?
Large enough so that you get a lot of records, but small enough such that it will comfortably fit into memory
3. How do you decide on this value? Consider, memory is 4 GB and currently about 2GB is consumed, and file to sort is 10GB in size. (Consumed memory could of course change dynamically during execution - consumed more/less by other apps.)
Why the size of a process grows larger in size for lots of small memory allocations. For example, say I have this struct, which is 16 bytes (for a 32 bit build):
Code: struct Person { int iID; int iAge; char * pForeName; char * pSurName; };
If I allocate memory like this:
Code: LPBYTE lpB = new BYTE[sizeof(Person) * 1000000];
Then my process grows to 16,48KB in size, which is what I expected. However if I allocate memory like this:
Code: Person * lpPerson; for(int i = 0; i < 1000000; ++i) lpPerson = new Person;
Then the process grows to 78,656KB, which I don't understand.
Additionally, I was surprised to find a vector acts more similarly to the first example. This code:
Code: Person temp = { 0 }; std::vector<Person> people; for(int i = 0; i < 1000000; ++i) people.push_back(temp);
Now I can't put data into the array scoresort[x]. I have tried everything. When the scoresort[x] is not an array I can input data. Although when it is an array it crashes my program. It will not process the line.
This is part of the HighScore section for a game that I am currently making.
For some reason, my input seems to lag one behind when inserting data. Attached, I have code that I wrote along with the example of the lag. What may be wrong with my code that is causing this to lag?