C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28695
Number of posts: 94715

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
PLS CHECK THE PROGRAM nd correct it Posted by coolbuddy on 6 Sept 2006 at 9:39 PM

THE QUESTION OF THIS PROGRAM HAS BEEN POSTED UNDER THE TOPIC
QUESTION PLZ HELP ME...C++ ADT

/* Program used to compute some statistics of similarity
Standard deviation stdev:
sqrt(( sum of the square of each term - square of mean )/(n-1))
USE MOSS.CPP
-----------------------------------------------------
/*Declaring and initialsing variables*/
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include "Moss.h"
using namespace std;

/*Main function*/
int main()
{
Moss temp;
temp.input_values();
temp.calc();
temp.output_values();

return 0;
}

/*End of program*/

MOSS.CPP
===========================================

#include "Moss.h"
#include <iostream>
#include <cmath>
#include<vector>

void Moss::input_values()
{
/*Implementing vectors*/
int dummy;
string s;

getline(cin,s,'(');
cin>>dummy;
p1.push_back(dummy);

getline(cin,s,'(');
cin>>dummy;
p2.push_back(dummy);

getline(cin,s,' ');
cin>>dummy;
nline.push_back(dummy);

cout<<p1[0]<<p2[0]<<nline[0];
int n;
cin>>n;
}

/*End*/
MOSS.H
-------------------------------------------

// File: Moss.h
#include <vector>
using namespace std;
class Moss {

/*Declaring private and public functions of a class*/
private:
vector<int> p1,p2,nline;

public:
void input_values();
void calc();
void output_values();

};



Report
Re: PLS CHECK THE PROGRAM nd correct it Posted by creeshna on 7 Sept 2006 at 10:03 AM
:
: THE QUESTION OF THIS PROGRAM HAS BEEN POSTED UNDER THE TOPIC
: QUESTION PLZ HELP ME...C++ ADT
:
: /* Program used to compute some statistics of similarity
: Standard deviation stdev:
: sqrt(( sum of the square of each term - square of mean )/(n-1))
: USE MOSS.CPP
: -----------------------------------------------------
: /*Declaring and initialsing variables*/
: #include <iostream>
: #include <string>
: #include <fstream>
: #include <sstream>
: #include "Moss.h"
: using namespace std;
:
: /*Main function*/
: int main()
: {
: Moss temp;
: temp.input_values();
: temp.calc();
: temp.output_values();
:
: return 0;
: }
:
: /*End of program*/
:
: MOSS.CPP
: ===========================================
:
: #include "Moss.h"
: #include <iostream>
: #include <cmath>
: #include<vector>
:
: void Moss::input_values()
: {
: /*Implementing vectors*/
: int dummy;
: string s;
:
: getline(cin,s,'(');
: cin>>dummy;
: p1.push_back(dummy);
:
: getline(cin,s,'(');
: cin>>dummy;
: p2.push_back(dummy);
:
: getline(cin,s,' ');
: cin>>dummy;
: nline.push_back(dummy);
:
: cout<<p1[0]<<p2[0]<<nline[0];
: int n;
: cin>>n;
: }
:
: /*End*/
: MOSS.H
: -------------------------------------------
:
: // File: Moss.h
: #include <vector>
: using namespace std;
: class Moss {
:
: /*Declaring private and public functions of a class*/
: private:
: vector<int> p1,p2,nline;
:
: public:
: void input_values();
: void calc();
: void output_values();
:
: };
:
:
:
:

wheres the implementation for calc() and output_values()? if you dont intend to do nothing, shouldnt you atleast put the skeletons out there, for the project to atleast link?

after adding

void Moss::calc()
{
}

void Moss::output_values()
{
}

the program compiled and linked...add what you need to do in either of the methods and you should be good, for the time being.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.