delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/10/11/08:15:19

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Per" <wga955m AT tninet DOT se>
Newsgroups: comp.os.msdos.djgpp
Subject: include conio and math
Date: Wed, 6 Oct 2004 16:08:34 +0200
Lines: 102
Message-ID: <ck0tig$7u3$1@yggdrasil.glocalnet.net>
NNTP-Posting-Host: du-64-177.ppp.telenordia.se
X-Trace: yggdrasil.glocalnet.net 1097070992 8131 62.127.64.177 (6 Oct 2004 13:56:32 GMT)
X-Complaints-To: abuse AT glocalnet DOT net
NNTP-Posting-Date: 6 Oct 2004 13:56:32 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi again!
I solved the problem by changing  as downbelow.
I saw this on an earlier answer.

#include <iostream>

using namespace std;

int main(void)
{
  cout << "hello" << endl;
  return 0;
}

However  I tested with a new program and this time conio and math does not
work.
I am using version 3.42 and

C:\cbl\lab\nyalab>gpp -o i.exe i.cc
i.cc:8:17: conio: No such file or directory (ENOENT)
i.cc:10:16: math: No such file or directory (ENOENT)
i.cc: In function `int main()':
i.cc:20: error: `clrscr' undeclared (first use this function)
i.cc:20: error: (Each undeclared identifier is reported only once for each
funct
ion it appears in.)
i.cc:29: error: `getch' undeclared (first use this function)
i.cc: In function `void calculate(double)':
i.cc:65: error: `sqrt' undeclared (first use this function)



#include <iostream>

using namespace std;

#include <conio>
#include <iomanip>
#include <math>
#define ESC 27


double readIn();
void calculate(double number);
int main()
{
  do
  {
  clrscr();
  double number;
  while(number>0)
  {
   clrscr();
   number = readIn();
     calculate(number);
  }

  }while(getch()!=27);
  return 0;
}




double readIn()
{
  double number;
  cout << " STATISTIKCALCULATION\n";
  cout << "====================\n";
  cout << "\n\nEnter in number : ";
  cin >> number;
  cout <<endl;
  return number;
}

void calculate(double number)
{
 int calculate_number=0;
 double square=0;

 double average=0;
 double sd;

  if(!number < 0)
 {

  calculate_number++;
   average+=number;
  average/=calculate_number;
  square+=number*number;
  }
 if(number < 0)
 {

sd=sqrt(((square-calculate_number*(average*average))/(calculate_number-1)));
  cout << "Average =: " << average << endl;
  cout << "SD = : " << sd << endl;
 }
}



- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019