I am trying to make a simple program for encrypting a char* with the XOR operator. The code compiles and links perfectly, but I get an Access violation runtime error:
#include <iostream> #include <cstdlib> #include <cstdio> #include <string> #include <fstream> using namespace std; int main(int argc, char** argv) {
This program I'm working on accepts an array size from the user, prompts the user to store that many integers, sorts them from smallest to largest, and then searches for duplicates with a simple for loop. The ultimate goal of the assignment was to display duplicates in an array, and the rest of the functions are just how I decided to reach that goal.
Anyway, my program crashes if I choose an array size larger than 7. It sorts and displays duplicates perfectly with 7 or fewer arguments.
The exact moment it crashes is after I enter the final value it prompts me for, so it appears my inputsize() function and my inputarray() function are working, and the error may be in the arrsort() function. Code is below:
Code: #include <stdio.h> int funcinputsize(int); void funcinputarray(int [], int size); void funcarrsort(int [], int size); void funcdupe(int [], int size);
I am having trouble sorting out a list of names in c. I have code for sorting the names, but when I go to print them out they still are in the same order as they were at the beginning so something isnt right. So the function that I need is the sort_data function.
matt susan mark david aden phil erik john caden mycah
So I need to get this list in alphabetical order, but when I run my code and print out this list after I run the sort function, they are still in this order.
So I have an insertion sort function implemented that sorts through an array, but I'm having a problem showing the correct number of comparisons to work.
Each time I'm checking a value with another, the counter should update.
For instance, having an array of 10 elements going from 10-1 should give 45 comparisons, but I'm getting 54 comparisons.
void insertionSort(int a[], int& comparisons, const int& numOfElements) { int j, value; for (int i = 1; i < numOfElements; i++) { value = a[i]; for (j = i - 1; j >= 0 && a[j] > value; j--)
This program using the selection, insertion, and bubble sorts. The program needs to be able to do the following:
1. Create an array of 1000 population records when the array object is instantiated. Call it unSorted.
2.Open the file called "Population.csv" (on the portal) and invoke a function that loads the population data into the array.
3.Create a second array of 1000 elements that will be used to sort the data using the different algorithms. Name is sortedArray.
4.Write a function that will copy unSorted into sortedArray and execute that function.
5.Using a function, display the unsorted array.
6.Invoke the insertionSort () function that will sort the sortedArray using the insertion sort algorithm. Sort the population data on the rank field in ascending order. Alternatively, you can sort in descending order on population.
7.Using the display function, display sortedArray.
8.Display the number of iterations it took to do the sort using this algorithm.
9.Repeat steps 4-8 for the selection and bubble sort algorithms.
Here is my code so far:
Code: #include <iostream> #include <iomanip> #include <fstream> using namespace std; void loadArray (int unSorted[], int s); void displayArray (const int num [], int size);
[Code] .....
Here is a few lines from the Population.csv file contents:
I'm not sure how to load the data from the file into the array properly, I attempted this. I also don't know how to copy the unSorted into sortedArray.
I downloaded Oracle instantclient-basic-nt-12.1.0.1.0.zip and instantclient-sdk-nt-12.1.0.1.0.zip and extracted both to c:oracle I then went into visual studio 2013 and created a Win32 Console application with all default parms.
I then went into project -> properties -> C/C++ -> General -> Additional Include Directories and added my include path C:oraclesdkinclude
I then went into project -> properties -> Linker -> General -> Additional Library Directories and added C:oraclesdklibmsvcvc11
I then went into project -> properties -> Linker -> Input -> Additional Dependancies and added oraocci12.lib
The program compiles but when I debug i get a RUNTIME error that says "The program can't start because oraocci12.dll is missing from your computer. Try reinstalling the program to fix this problem. But I know the file exists in C:oraclesdklibmsvcvc11oraocci12.lib
This is the code if it makes a difference
Code: #include "stdafx.h" #include <iostream> #include <occi.h> using namespace std; int _tmain(int argc, _TCHAR* argv[])
I am getting a strange runtime error when trying to run my hash table program. I have it separated in 3 separate files. I believe I have narrowed down where the error is occurring. It is either happening in insert(const &string s) or in the implementation of vector<list<string>> ht. I would appreciate some input. This is the implementation of insert():
void HTable::insert(const string &s) { int h = hash(s); cout<<h<<endl; list<string> &tempList = ht[h];
[Code] .....
And it is giving me some sort of compilation error saying I cannot convert a type string to type list.
run-time check failure #0 - the value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention
when i try to run my code. It has compiled fine on another computer, but it simply will not work on this one. This is the part of code where it is receiving the error. it has to do with the stoi
Code: #include <string> // for use of string #include <fstream> //for file handling #include <iostream> // for file handling #include <cstdlib> #include <iomanip> //for the setprecision used further below using namespace std; struct MasterData //struct created named 'MasterData' to hold one line from master file
I wrote a program that use a struct to represent an athlete. The program allocates memory for an array of 5 Athletes, and, soon after I enter the fourth data (height) for the first athlete, I get the message "runtime Error R6002 - floating point support not loaded". The program doesn't reach the line where __LINE__ would be printed.
My program needs to compile various source files at runtime.What is the most elegant way to compile cross platform with g++ from within my program? Is there a gcc-library I can use? I know that I could use popen() to open a Unix pipe and call g++ as command line tool. But first it isn't really cross platform and second it doesn't seem elegant to me.
What I want to create is a program that sorts through a huge list (millions of lines).
I want it to get rid of any line that contains a word that isn't in an English dictionary.
Example list:
00sdfdsf ahdadsg angel ksjflsjdf green green000 carrot
and it would go through millions like that, giving me only:
angel green carrot
as my new list.
How could I go about this? What programs would I need? And at the very least how can I remove unwanted things like numbers, double letters, underscores etc.?
Design a C++ Program to implement the following functions:
a.)the function for bubble sorting : int bubblesort(int*a,int size). b.)the function for merge sorting : int mergesort(int*a,int size). c.)the function for generating array of random elements: int generate(int*a,int size) which calls the function rand() in c++. d.)Test both bubble sorting and merge sorting with 10,100,1000,10000,100000 and 1000000,4000000 integers.
The integers are from the array generated by part c).calculate the time spent in calling each sorting.you may use a function in <time.h>to get the current time. Draw curves to compare the speed performance between the two functions. The merge sorting algorithm implementation must use recursion. you are expected to define a global array for holding result from merging two arrays.otherwise,it may cause a lot extra money in recursion.
Hint 1:use the following format to calculate the time cost for bubble sort.
{…….. Time1=Get the current time(call a function in <time.h>); Bbblesort(….) Tme2=Get the current time(call a function in <time.h>); Time_cost=the difference between time 1 and tim2; ……. } Print your program and test results
Been working on this program for a while. It's currently broken in several parts but it at least reads and stores the data into the arrays correctly. The problem is writing the sort function and the swap function. The other problem is writing both of these to keep the correct ages with the correct names.
/* Write a program to allow the user to enter up to ten people with their age. The names will be a full name consisting of a last, possibly a middle initial, and a first name. The full name will be no longer than 40 characters in length. The full will be stored in an array of strings, a two dimensioned array of characters. The ages will be stored in an array of integers. Manage the arrays as parallel arrays. Data entry will be from the keyboard and will read the full name followed by the age. Data entry will terminate when the arrays are full or when nothing is entered for the full name. Use a subroutine to enter the data and pass the arrays to the subroutine, do not use global arrays. Once the data is completely entered, use another subroutine to print out the arrays to the screen. Then use a subroutine to sort the data on the full names, ascending order. Reuse the print subroutine and print the sorted data out to the screen. Write another subroutine which sorts the data on age as the primary sort and full name as the secondary sort. Finally reuse the print subroutine to print the data to the screen. The main program will call the data entry function, followed by the print function, the name sort function, the print function, the age sort function and finally the print function. All data will be passed to the functions, no global data. */