need help...does anyone knows how to write header and implementation code for ADT?
I'm working on a ADT. I'm writing a program to cin a software similarity report and to cout output on a number of statistics after running MOSS. So far, I've only been able to piece together a rudimentary code for the header and implementation file. (because i'm new to C++)...
a sample line of output from MOSS(which is the input for my program)
File1-111(71%) File2-111(63%) 101
means that 71% of code of file1 is similar to 63% code of file2 , 177 lines similar and is the record number 101. if record number is 101, means there are 101 files received. this match is based on the highest level of similarity so file1 will not be matched to another file for another percentage rating..
now i've to refine my header...
Code:
// File: Moss.h
using namespace std;
class Moss { //class definition for Moss
//private:
//protected:
public:
Moss(double p1_cent, double p2_cent, int nlines, int rec_num);
double get_p1_cent() const;
double get_p2_cent() const;
int get_nlines() const;
int get_rec_num() const;
double get_stdev() const;
};
and my implementation file
Code:
// File name: Moss.cpp
#include "Moss.h"
#include <iostream>
#include <cmath>
//Moss method definitions
Moss::Moss(double pp1_cent, double pp2_cent, int nnlines, int nrec_num)
{
p1_cent = pp1_cent;
p2_cent = pp2_cent;
nlines = nnlines;
rec_num = nrec_num;
}
double Moss::get_p1_cent() const
{
return p1_cent;
}
double Moss::get_p2_cent() const
{
return p2_cent;
}
double Moss::get_nlines() const
{
return nlines;
}
double Moss::get rec_num() const
{
return rec_num;
}
double Moss::stdev(int record[n], double mean)
{
for(n=0;n<= rec_num;n++)
{
sqrt(pow((record[n]*mean),2))/(n-1);
}
return result;
}
and then also to design a main() function to cin all the data that is in the report....
can someone help??
how to get rid of qn mark at end of output?
Code:
#include <iostream>
#include <fstream>
using namespace std;
int main () {
char c, str[256];
ifstream is;
cout << "Enter the name of an existing text file: ";
cin.get (str,256);
is.open (str);
while (is.good()) {
c = is.get();
cout << c;
}
is.close();
return 0;
}
i found a way but how come a question mark keeps appearing at end of file output even when the file does not contains that question mark?