Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Writting Code

pseudocode

  • Please log in to reply
9 replies to this topic

#1 Japp

Japp

    CC Newcomer

  • Member
  • PipPip
  • 16 posts

Posted 29 January 2012 - 06:24 PM

Provide your analysis for the following problem statement: You need to write a program that would calculate the results for the multiplication table up from 1 to 100. (For example, 1X1, 1X2, 1X3 … 1X10, 2X1, 2X2 …. 10X2 … 10x10). Your program should print the output for each step and output a new line after 10 items. So the example output would be something like this Notice a new line appears after 10 steps:

1 2 3 4 5 6 7 8 9 10

2 4 6 8 10 … 20



10 20 30 … 100



To write the new lines you can just use code similar to : write “new line”. Hint: You will probably use a nested repetition loop.

Your analysis should be clearly written and demonstrate your thought process and steps used to analyze the problem. Be sure to include what is the required output? What is the necessary input and how you will obtain the required output from the given input? Also, include your variable names and definitions. Be sure to describe any necessary formulas and sample calculations.

2. Provide your program design for the program you analyzed for printing the multiplication table. Be sure to describe the fundamental tasks (i.e., things your program must do) needed to solve the problem so you can use a modular design. Provide pseudocode of your overall design that includes the Main module and the order of the module calls, and a Hierarchy chart for the program . Finally, display the flow charts for each module. (FLOW CHARTS I CAN DO)

Include header and step comments in your pseudocode, 3. Prepare any input data (Test data) along with expected output for testing your program (Note: Programs may not always have both input and output data. Just provide test cases for your application). Your test data can be presented in the form of a table as was shown in Assignment 1

Edited by Japp, 19 February 2012 - 09:23 AM.
wronginfo

  • 0

#2 Nazim Mammadov

Nazim Mammadov

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 30 January 2012 - 12:08 AM

#include <iostream>  



using namespace std;





int main() {



	int nickel, penny1=1, penny2=1,  penny3=1, quarter, dime;

	



	cout<<"Enter the amount of nickels: ";

	cin>>nickel;



	cout<<"Enter the amount of dimes: ";

	cin>>dime;



	cout<<"Enter the amount of quarters: ";

	cin>>quarter;



	penny1 = nickel * 5;

	penny2 = dime * 10;

	penny3 = quarter *25;



	cout<<"Total amount of pennies = "<<penny1+penny2+penny3<<endl;



	return 0;



	system ("PAUSE");







}

  • 0

#3 Japp

Japp

    CC Newcomer

  • Member
  • PipPip
  • 16 posts

Posted 30 January 2012 - 07:26 AM

Thank you Nazim I think since we are totally beginners we use Visual Basic. Was told didn't need any experience. Wrong!

Just a few questions, Pls bare with me. What is

#include <iostream>
using namespace std;
int main() {

Also In the int why did you add (penny1=1, penny2=1)? penny3=1?
Thank you
  • 0

#4 Nazim Mammadov

Nazim Mammadov

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 30 January 2012 - 10:07 AM

iostream is header file from C standard library. It need to put to the stream (cout) and get from the stream (cin). using namespace std we use do not always repeat
std:: before cin and cout and etc. penny1, penny2 and penny3 I used to calculate nickels, dimes, and quarters. I give the penny1/2/3 value "1", but there is no need. main is the function. You can write your own functions. But function main have to be in all programs.

Could you compile and run the program? what programming language are you learning?
  • 0

#5 Willum

Willum

    CC Lurker

  • New Member
  • Pip
  • 9 posts

Posted 01 February 2012 - 02:05 PM

Thank you Nazim I think since we are totally beginners we use Visual Basic. Was told didn't need any experience. Wrong!

Just a few questions, Pls bare with me. What is #include <iostream>
using namespace std;
int main() {
Also In the int why did you add (penny1=1, penny2=1)? penny3=1?
Thank you


He wrote that in C++. Not Visual Basic. Its best to tell us what programming language your using up front, otherwise people will make assumptions (C++ is a very popular language). If your learning your first language, and you haven't started yet, why not switch to C++? There's much more documentation, although I don't know anything about Visual Basic, but C++ is a great language to learn, I'd reccomend it.
  • 1

#6 MeekLogic

MeekLogic

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 177 posts
  • Location:Fresno, CA
  • Programming Language:C#, PHP, JavaScript, PL/SQL, Visual Basic .NET, Lua

Posted 09 February 2012 - 08:27 PM

He wrote that in C++. Not Visual Basic. Its best to tell us what programming language your using up front, otherwise people will make assumptions (C++ is a very popular language). If your learning your first language, and you haven't started yet, why not switch to C++? There's much more documentation, although I don't know anything about Visual Basic, but C++ is a great language to learn, I'd reccomend it.


While C++ is a great language it's not what I would say the easiest to learn first off. Personally I would recommend PHP or C# to start with. C# over VB because it's syntax is similar to C++.

Edit: OP, would you like a nice Console example in VB.Net?
  • 0

#7 Japp

Japp

    CC Newcomer

  • Member
  • PipPip
  • 16 posts

Posted 14 February 2012 - 06:36 PM

Ok I totally bombed failed on that one . My Prof said no C+, that we are using basic computer language, that its the basic for all languages; that it is not Visual, C+, so I cant use the tutorials on this site. Prof said that this class objective is to design programs using pseudocode . Algorithms are used to demonstrate programming as an approach to problem solving. I am at a total lost. This is the latest assignment


Provide your analysis for the following problem statement: You need to write a program that would calculate the results for the multiplication table up from 1 to 100. (For example, 1X1, 1X2, 1X3 … 1X10, 2X1, 2X2 …. 10X2 … 10x10). Your program should print the output for each step and output a new line after 10 items. So the example output would be something like this Notice a new line appears after 10 steps:

1 2 3 4 5 6 7 8 9 10

2 4 6 8 10 … 20



10 20 30 … 100



To write the new lines you can just use code similar to : write “new line”. Hint: You will probably use a nested repetition loop.

Your analysis should be clearly written and demonstrate your thought process and steps used to analyze the problem. Be sure to include what is the required output? What is the necessary input and how you will obtain the required output from the given input? Also, include your variable names and definitions. Be sure to describe any necessary formulas and sample calculations.

2. Provide your program design for the program you analyzed for printing the multiplication table. Be sure to describe the fundamental tasks (i.e., things your program must do) needed to solve the problem so you can use a modular design. Provide pseudocode of your overall design that includes the Main module and the order of the module calls, and a Hierarchy chart for the program . Finally, display the flow charts for each module. (FLOW CHARTS I CAN DO)


Include header and step comments in your pseudocode, using a similar approach as the example provided in section 2.3 (textbook page 86). See example 2.8 on pages 87-88).

3. Prepare any input data (Test data) along with expected output for testing your program (Note: Programs may not always have both input and output data. Just provide test cases for your application). Your test data can be presented in the form of a table as was shown in Assignment 1.

I'm still working on it and will post what I have tomorrow so dont post anything but thanks in advance.
  • 0

#8 Soryy708

Soryy708

    CC Resident

  • Banned
  • PipPipPipPip
  • 59 posts

Posted 15 February 2012 - 05:04 PM

#include <stdio.h> // library (header) for basic input-output operations
int main() // main program
{
	int Num1; // integer variable; stores decimal numbers
	int Num2;
	
	for(Num1 = 1; Num1 <= 10; Num1++) // Make equal 1, while less and equal to 10, increase by one each loop
	{
		for(Num2 = 1; Num2 <= 10; Num2++)
			printf("%d ", Num1 * Num2); // Print result of multiplication
		printf("\n"); // Print new line
	} // end for
	return 0; // terminate program
} // end main
Just thought that would help.
  • 0

#9 Japp

Japp

    CC Newcomer

  • Member
  • PipPip
  • 16 posts

Posted 19 February 2012 - 12:48 PM

The pseudocode would be something like this: Is this correct?

for i is 1 to 10
for j is 1 to 10
write i * j + " "
next j
write new line
  • 0

#10 Soryy708

Soryy708

    CC Resident

  • Banned
  • PipPipPipPip
  • 59 posts

Posted 19 February 2012 - 09:14 PM

Pretty much
  • 0





Also tagged with one or more of these keywords: pseudocode

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download