在我的程序中收到错误,“不支持的16位程序”

时间:2014-06-04 13:34:12

标签: c windows compatibility win64

我一直在为我的CS1课程做作业,但是我遇到了一个奇怪的错误,我在任何一个程序中都没有收到过。我的错误:http://i1306.photobucket.com/albums/s576/sammyr2011/cs1laberror_zps9c06e872.jpg。 我不确定是什么规定程序是32位,64位或任何位。因此,如果可以解释,将不胜感激。如何让我的程序再次兼容?调用的函数在教授提供的另一个库中。 我的节目:

/*
 *  Lab 1 - Data Sets
 *  DataSet.h: The purpose of the first lab is to get us started with the Eclipse
 *  environment as well as understanding/ using someone elses code to write our
 *  own.
 */

#ifndef DATASET_H_
#define DATASET_H_

#include <stdio.h>
#include <stdlib.h>
#include "DArray.h"
#include <stdbool.h>


struct DataSet{

struct DArray* setData;

Byte minValue;

Byte maxValue;

};

struct DataSet* allocDataSet(){

struct DataSet* dataSet = (struct DataSet*)malloc(sizeof(struct DataSet));

dataSet->setData = allocDArray(10);    //code reuse

//oposite extremes are assigned to one another such that they may be
//updated when some entered value is smaller than minValue or larger than maxValue

dataSet->minValue = 255;

dataSet->maxValue = 0;

return 0;

}

/* This function frees the memory space allocated earlier by
 * allocDataSet. Remember to free any pointer that DataSet
 * holds before freeing the DataSet itself. Hint: use the
 * releaseDArray function */
void releaseDataSet(struct DataSet* dset)
{
    free(dset->setData);
    free(dset);

}

void appendDataSet(struct DataSet* dataSet, Byte newValue){
if(containsDArray(dataSet->setData, newValue) == 0) //don't want doubles since it's     a set!!
        {
        if(newValue < dataSet->minValue)
    {
         newValue = dataSet->minValue;

    }
        else if(newValue > dataSet->maxValue)
    {
            newValue = dataSet->maxValue;
    } 
        else
    {   
    }
        appendDArray(dataSet->setData, newValue);

}
    else
{
        printf("The value is already in the dataset!");
}


}

//use contains function?
//add setA to the array completely and then check to see if
//values in setB are in SetA.
struct DataSet* unionDataSet(struct DataSet* setA, struct DataSet* setB){
int i = 0;
struct DataSet* setC;
setC = setA;
//check one by one to see if values of setB are in setC if not use append function
for(i = 0;i < setA->setData->length; i++)
{
    if(containsDArray(setC->setData, setB->setData->data[i]) == 0)
    {
        appendDataSet(setC, setB->setData->data[i]);
    }
    else
    {

    }
}

return setC;
}

//nested loop starting with a value of setA and cycle through setB
//and next value of setA and so on. Using containsDArray().
struct DataSet* intersectionDataSet(struct DataSet* setA, struct DataSet* setB){
int i = 0, j = 0;
struct DataSet* setC;
for(i = 0; i < setA->setData->length; i++)
{
    if(containsDArray(setB->setData, setA->setData->data[i]) == 1)
    {
        //if so add to setC, change append to include the head value?
        appendDataSet(setC, setA->setData->data[i]);
    }
    else
    {
        //if not continue loop
    }

}

return 0;
}

//step 10

struct DataSet* diffDataSet(struct DataSet* setA, struct DataSet* setB)
{
    int i = 0, j = 0;
    struct DataSet* setC;
    setC = setA;
    for(i = 0; i < setA->setData->length; i++)
{
    setC->setData[i];
    for(j = 0; j < setB->setData->length; j++)
    {
        if(containsDArray(setC->setData, setB->setData->data[j]) == 1)
        {
            removeDArray(setA->setData, setC->setData->data[i]);
        }
    }
}

return setC;
}

//step 11: return a DataSet that contains all elements on mainSet[start:end].
//That is the elements on the mainSet, starting at start position until end
//position. Thus, the result is a subset of mainSet

//make the loop while less than the difference of the start and end.
struct DataSet* subset(struct DataSet* mainSet, int start, int end){
int i;
struct DataSet* setC;
for(i = 0; i < (end - start); i++)
{
    setC->setData->data[i] = mainSet->setData->data[start];
}

return setC;

}

//step 12: must include stdbool.h ...  returns true if all elements in A are found in B   and A is smaller than B, meaning that A is a subset of B

bool isSubset(struct DataSet* A, struct DataSet* B){
int i = 0;
if ( A->setData->length < B->setData->length)
{
    for(i = 0; i < A->setData->length; i++)
    {
         while(1)
         {
            containsDArray(B->setData, A->setData->data[i]);
         }
    }
}
else
{

}
}

//step 13: get the average of the elements inside the DataSet

float AverageDataSet(struct DataSet* dataSet)
{
int i = 0, sum = 0;
float average = 0;
for(i = 0; i < dataSet->setData->length; i++)
{
    sum += dataSet->setData->data[i];
}
average = sum/dataSet->setData->length;
return average;

}

//step 14: this function could help on step 13. Gets the sum of all elements in the DataSet

//Word SumDataSet(struct DataSet* dataSet){
// }

// step 15: Notice that you could use the applyDArray function to just apply a pow
// function or a square function defined by you (there is one located at main). The
// result is returned as a DataSet and not as a Word*, meaning 2 things: 1) the
// squared values will be the elements of a dataset and 2) some or maybe all values
// will overflow the maximum value of a Byte. This is for you to see what happens
// that occurs. I will provide with what the answer to the whole lab is so that you
// can compare with yours.

//struct DataSet*

//step 16: Range is |max - min|
//look at discussion section
//Byte RangeDataSet(struct DataSet* dataSet){
//
//
//
//}

//step 17:

void printDataSet(struct DataSet* dataSet)
{
int i = 0;

for(i = 0; i < dataSet->setData->length; i++)
{
    dataSet->setData[i];
    printf("%d", dataSet->setData[i]);
}


}

//step 18: returns true if testSet is the NULL set, meaning it empty with no elements
//inside of it, useful specially when you want to check if the intersection of two sets is empty

bool isNull(struct DataSet* testSet){



}

//step 19: maybe this and the contains I believe that is inside DArray are your best friends for this lab

/*bool contains(struct DataSet* dataSet, Byte testValue){



}*/

//step 20: returns true if all elements in setA are found in setB and they both have the same
//length. The order of the elements is not important for testing equality of two sets.

/*bool equals(struct DataSet* setA, struct DataSet* B){



}*/

#endif /* DATASET_H_ */

0 个答案:

没有答案