357mag 2 Posted Monday at 11:10 PM Here is one of my projects which was written in an earlier version of C++ Builder. You will notice that I'm using #include<conio.h> plus I'm using getch(); // This program demonstrates writing a simple function to cube a number #include <iostream> #include <conio.h> using namespace std; int cube(int y); // function prototype int main() { int x; cout << "Enter an integer value: "; cin >> x; int answer = cube(x); // call the cube function and pass x as an argument and assign result to the variable answer cout << "That number cubed is " << answer << endl; // print the result getch(); return 0; } int cube(int y) // function definition { return y * y * y; } Share this post Link to post
Remy Lebeau 1436 Posted Tuesday at 06:30 AM (edited) And, the point of this post is... what, exactly? I don't see a question or problem stated. However, why were you ever mixing C's <conio.h> with C++'s <iostream> in the first place? Get rid of <conio.h>, you don't need it. Use std::cin.get() instead of getch(). Edited Tuesday at 06:31 AM by Remy Lebeau Share this post Link to post
357mag 2 Posted yesterday at 08:27 PM Someone asked to see the code. So I post the code. Share this post Link to post
David Heffernan 2353 Posted yesterday at 10:25 PM 1 hour ago, 357mag said: Someone asked to see the code. So I post the code. Imagine we are starting at the beginning of this post. What are we to make of what is in this page alone? Share this post Link to post
Remy Lebeau 1436 Posted yesterday at 10:37 PM (edited) 2 hours ago, 357mag said: Someone asked to see the code. So I post the code. Then you should have posted the code as a reply to that earlier discussion. Instead, you posted it as a new discussion with no context. At least add a link to the original discussion. Edited yesterday at 10:37 PM by Remy Lebeau Share this post Link to post