Solved

ver5.cpp, ver_6, ver_7 and ver_8 Code Corrections

Posted on 2004-04-12
3
315 Views
Last Modified: 2010-04-01
Need help in correcting actual codes.  Errors returned from unix.  Please advise.  Del

Code 1:

// ver_7.cpp

#include <iostream>

using namespace std;

int main()
{
   point p_array[2];
   double distance;
   inputFun(p_array);
   distance = calculate_fun(p_array);
   printFun(distance);

   return 0;

}

Code 2:

// ver_8.cpp

#include <iostream>

using namespace std;

int main()
{
   DistanceOfPoints obj_1;
   obj_1.inputFun();
   obj_1.calculateFun();
   obj_1.printFun();

   return 0;
}

Code 3:

// ver_6.cpp

#include <iostream>

using namespace std;

void input_fun(double p_array[2][3]);
double calculate_fun(double p_array[2][3]);
void print_fun(double distance);

int main() {

   double p_array[2][3];
   double distance;

   input_fun(p_array);
   distance = calculate_fun(p_array);
   print_fun(distance);

   return 0;

}

void input_fun(double p_array[2][3]) {

   for(int i = 0; i <= 1; i++)
       for(int j = 0; j <= 2)
            cin >> p_array[i][j];

}

double calculate_fun(double p_array[2][3]) {

   double distance;
      
   distance =

   return distance;

}

void print_fun(double distance) {

   cout << "distance = " << distance << endl;

}

code 4:

// ver5.cpp

#include <iostream>
#include <cmath>

using namespace std;

void input fun(p_array);
double calculate fun(p_array);

int main() {


   double p_array[2][3]; // data structure, memory location for your variable
   double d;

   input fun(p_array);
   calculate fun(p_array);
   print fun(double d);

   d = calculation function;

   print fun(d);

   return 0;

}









0
Comment
Question by:edelossantos
  • 2
3 Comments
 

Author Comment

by:edelossantos
ID: 10810349
I would greatly appreciate help from anyone.  Please advise.  Del
0
 
LVL 4

Accepted Solution

by:
bkfirebird earned 500 total points
ID: 10810369
could you be a little clearer .... what errors ? which part of the code ?
0
 

Author Comment

by:edelossantos
ID: 10810428
ver5.cc:6: `p_array' was not declared in this scope
ver5.cc:6: variable or field `inputFun' declared void
ver5.cc:7: `p_array' was not declared in this scope
ver5.cc: In function `int main()':
ver5.cc:15: variable or field `inputFun' declared void
ver5.cc:15: initialization to `int' from `double (*)[3]' lacks a cast
ver5.cc:16: initialization to `double' from `double (*)[3]'
ver5.cc:17: parse error before `)'
ver5.cc:19: `calculation' undeclared (first use this function)
ver5.cc:19: (Each undeclared identifier is reported only once
ver5.cc:19: for each function it appears in.)
ver5.cc:19: parse error before `;'
ver5.cc:21: `print' undeclared (first use this function)

ver_6.cpp: In function `void input_fun(double (*)[3])':
ver_6.cpp:27: parse error before `)'
ver_6.cpp:38: parse error before `return'
ver_6.cpp:42: parse error before `{'

ver_7.cpp: In function `int main()':
ver_7.cpp:9: `point' undeclared (first use this function)
ver_7.cpp:9: (Each undeclared identifier is reported only once
ver_7.cpp:9: for each function it appears in.)
ver_7.cpp:9: parse error before `['
ver_7.cpp:11: `p_array' undeclared (first use this function)
ver_7.cpp:11: implicit declaration of function `int inputFun(...)'
ver_7.cpp:12: implicit declaration of function `int calculate_fun(...)'
ver_7.cpp:13: implicit declaration of function `int printFun(...)'

ver_8.cpp: In function `int main()':
ver_8.cpp:7: `DistanceOfPoints' undeclared (first use this function)
ver_8.cpp:7: (Each undeclared identifier is reported only once
ver_8.cpp:7: for each function it appears in.)
ver_8.cpp:7: parse error before `;'
ver_8.cpp:8: `obj_1' undeclared (first use this function)

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now