Hallo Im braucht ein wenig Hilfe mit meinem Programm
im mit Borland C + + 5.0 unter WinXP
-----------------------------------------------
Beschreibung:
Diese Angaben wurden auf einer Datei eingegeben - "highmark.dat" Die Marken sind auf die Datei als Integer gespeicherten Werte ein Wert pro Zeile.
Das Verwaltungspersonal gelegentlich Fehler machen die Eingabe der Daten. Aus diesem Grund sollte Ihr Programm ignorieren Marken, die größer als 100 oder kleiner als 0 sind.
Ihr Programm ist:
1. Lesen Sie die Zeichen in ein Array;
2. Art des Arrays;
3. einen Bericht, den Bildschirm von der sortierten Array.
Der Bericht ist zu zeigen:
- Die höchste Punktzahl erreicht;
- Die niedrigste Marke erreicht;
- Ein Diagramm, das die Häufigkeit der einzelnen Zeichen in das Array.
Eine Art Funktion vorgesehen ist (intsort.cpp und intsort.h) und ist in einem Projekt mit Ihren Source-Code integriert werden.
-------------------------------------------------
Datendatei
========
Hohenmark. dat
101
-1
100
95
0
95
85
95
90
90
90
90
-5
101
85
Beispiel Output:
Bericht über die Hohe Mark
Bester: 100
Niedrigster: 0
0 *
85 **
90 ****
95 ***
100 *
#include <fstream.h>
#include <conio.h>
#include <iostream.h>
#include <ctype.h>
#include <iomanip.h>
#include "intsort.h"
//Prototypes
int initial (int Marks[]);
int GetMarks (ifstream &MarkFile, int Marks[]);
int Report (int Marks[]);
//Constant
const int Max_Size=20;
//Global Variables
int AMark, NumMarks, var;
int Count=0;
int HiMark=0;
int LoMark=0;
int Marks[Max_Size];
//***************************************************/
void main()
{
ifstream MarkFile ("highmark.dat"); //File Details
clrscr();
initial (Marks); //Initializing Variable
if (MarkFile) //If File exists Continue
{
NumMarks = GetMarks (MarkFile, Marks); //Reads in Marks, returns total number of marks
SortArray (NumMarks, Marks); //Sorts Array (Teachers File)
Report (Marks); //Displays Report
MarkFile.close(); //Closes File
getch();
}
else
{
cout<<"File Not Found"; //No File Error Message
getch();
}
} // end Main
//******************************************************************************
int initial(int Marks[])
{
while (var!=Max_Size)
{
Marks[var]= -1; //Setting all parts of array to -1
var++; //Adding to var
}
}
//end initial
//******************************************************************************
int GetMarks (ifstream &MarkFile, int Marks[])
{
MarkFile>>AMark; //Reads in intial Mark
while (!MarkFile.eof()&&Count<Max_Size) //While not End of File & Count < Max Size
{
Marks[Count]=AMark; //Marks array gets Mark
Count++; //Adds 1 to Count
MarkFile>>AMark; //Reads in next Mark
}
return Count; //Returns Count for NumMarks
} //end GetMarks
//******************************************************************************
int Report (int Marks[])
{
for (Count=0; Count != Max_Size; Count++) //For loop to Calculate Highest & Lowest Marks
{
if (Marks[Count]<=100 && Marks[Count]>=0) //Validation
if (Marks[Count]>HiMark) //If current array position > Highest so far
HiMark = Marks[Count]; //Gets Assigned
else if (Marks[Count]<LoMark) //If current array position < Lowest so far
LoMark = Marks[Count]; //Gets Assigned
}
cout<<"\n \n Final Report"<<endl; //Displaying Results
cout<<"\n \n Highest Mark:"<<(setw(7))<<HiMark<<endl;
cout<<"\n Lowest Mark:"<<(setw(7))<<LoMark<<endl<<endl;
for (Count=0; Count != Max_Size; Count++) //For loop calculates amount of times a number appears
{
if (Marks[Count]<=100 && Marks[Count]>=0) //Validation
if (Marks[Count] == Marks[Count+1]) //If Current Position = Next Position
cout<<"*"; //Display *
if (Marks[Count]<=100 && Marks[Count]>=0) //Validation
if (Marks[Count] != Marks[Count+1]) //If Current Position != Next Position
cout<<"*"<<Marks[Count]<<endl; //Display *, Displays Number, Ends Line
}
} //end Report
- #include <fstream.h>
- #include <conio.h>
- #include <iostream.h>
- #include <ctype.h>
- #include <iomanip.h>
- #include "intsort.h"
- //Prototypes
- int initial (int Marks[]);
- int GetMarks (ifstream &MarkFile, int Marks[]);
- int Report (int Marks[]);
- //Constant
- const int Max_Size=20;
- //Global Variables
- int AMark, NumMarks, var;
- int Count=0;
- int HiMark=0;
- int LoMark=0;
- int Marks[Max_Size];
- //***************************************************/
- void main()
- {
- ifstream MarkFile ("highmark.dat"); //File Details
- clrscr();
- initial (Marks); //Initializing Variable
- if (MarkFile) //If File exists Continue
- {
- NumMarks = GetMarks (MarkFile, Marks); //Reads in Marks, returns total number of marks
- SortArray (NumMarks, Marks); //Sorts Array (Teachers File)
- Report (Marks); //Displays Report
- MarkFile.close(); //Closes File
- getch();
- }
- else
- {
- cout<<"File Not Found"; //No File Error Message
- getch();
- }
- } // end Main
- //******************************************************************************
- int initial(int Marks[])
- {
- while (var!=Max_Size)
- {
- Marks[var]= -1; //Setting all parts of array to -1
- var++; //Adding to var
- }
- }
- //end initial
- //******************************************************************************
- int GetMarks (ifstream &MarkFile, int Marks[])
- {
- MarkFile>>AMark; //Reads in intial Mark
- while (!MarkFile.eof()&&Count<Max_Size) //While not End of File & Count < Max Size
- {
- Marks[Count]=AMark; //Marks array gets Mark
- Count++; //Adds 1 to Count
- MarkFile>>AMark; //Reads in next Mark
- }
- return Count; //Returns Count for NumMarks
- } //end GetMarks
- //******************************************************************************
- int Report (int Marks[])
- {
- for (Count=0; Count != Max_Size; Count++) //For loop to Calculate Highest & Lowest Marks
- {
- if (Marks[Count]<=100 && Marks[Count]>=0) //Validation
- if (Marks[Count]>HiMark) //If current array position > Highest so far
- HiMark = Marks[Count]; //Gets Assigned
- else if (Marks[Count]<LoMark) //If current array position < Lowest so far
- LoMark = Marks[Count]; //Gets Assigned
- }
- cout<<"\n \n Final Report"<<endl; //Displaying Results
- cout<<"\n \n Highest Mark:"<<(setw(7))<<HiMark<<endl;
- cout<<"\n Lowest Mark:"<<(setw(7))<<LoMark<<endl<<endl;
- for (Count=0; Count != Max_Size; Count++) //For loop calculates amount of times a number appears
- {
- if (Marks[Count]<=100 && Marks[Count]>=0) //Validation
- if (Marks[Count] == Marks[Count+1]) //If Current Position = Next Position
- cout<<"*"; //Display *
- if (Marks[Count]<=100 && Marks[Count]>=0) //Validation
- if (Marks[Count] != Marks[Count+1]) //If Current Position != Next Position
- cout<<"*"<<Marks[Count]<<endl; //Display *, Displays Number, Ends Line
- }
- } //end Report
jetzt das Problem im immer ist dies
Info: Kompilieren E: \ PROGRAMMING2 \ assign1.cpp
Warn: assign1.cpp (56,2): Funktion sollte einen Wert zurückgeben
Warn: assign1. cpp (97,2): Funktion sollte einen Wert
Info: Verknüpfung von E: \ PROGRAMMING2 \ ASSIGN1.exe
Fehler: Fehler: Nicht aufgelöstes externes SortArray (int, int *) verwiesen wird vom Modul assign1.cpp
Ich verstehe nicht, warum die Funktionen keinen Wert zurückgeben.
Kann jemand mir helfen, bin ich sehr verwirrt

Danke
Venetian.