Jump to content

Help understanding this

- - - - -

  • Please log in to reply
4 replies to this topic

#1
geno53

geno53

    Newbie

  • Members
  • PipPip
  • 11 posts
Using the pseudo-code and the top-down modular approach

Develop a menu-driven program that inputs a number X, and at the user's option, finds and displays the area (A) of one of the following:

A square with side X, A = X^2

#2
artificial

artificial

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 624 posts
What exactly do you not understand?
Sometimes words ain't enough to express something. That's why computer scientists use double words.

#3
geno53

geno53

    Newbie

  • Members
  • PipPip
  • 11 posts
I was trying to use the proper code to make this question work, and have the computer give the user correct answer, here's the direction I took. maybe i should use VB or C++ to get the proper results.
A =5 , X=5^2
Main
Declare A, X as integer
Set A = sqrt
Set power= x, n
Write “Find the area of A”
End program
Function square as float
Function power as float
If x ==25, then
Write “ the total of A is”
Set total = (A) * 2
End if
End function
Total = 25

#4
artificial

artificial

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 624 posts
Okay, I thought your problem wouldn't be that straightforward.

Here's a C++-example:


#include <iostream.h>


int main(int argc, char* argv[])

{

   int x = 0;


   cout << "Please enter the edge length...\n"

   cin >> x;


   x *= x;


   cout << "Area is " << x << "!\n";


   return 0;

}


It might be that you have to use using namespace std.

Greets,
artificial
Sometimes words ain't enough to express something. That's why computer scientists use double words.

#5
geno53

geno53

    Newbie

  • Members
  • PipPip
  • 11 posts
Thanks I'm try this example.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users