A simple pseudo-code

This is a discussion on A simple pseudo-code within the C++ Programming forums, part of the General Programming Boards category; Hi everyone, I just joined this forum and hope to get help from you, experienced guys. I am an Engineering ...

  1. #1
    Registered User
    Join Date
    Oct 2013
    Posts
    3

    Question A simple pseudo-code

    Hi everyone,
    I just joined this forum and hope to get help from you, experienced guys.
    I am an Engineering student and this is the first computer course I'm taking, so I know nothing! Please help!

    Problem #1:
    I have a question to write a pseudo-code: In this Task, you are required to write the pseudo-code for a program that computes the first and last digit of a number. For example, if the input is 23456, the program should print out 2 and 6.

    Problem #2:
    I have a mac and the program I have is eclipse. I had my first program to run but it gives me some errors; I don't know what the problem is. I tried to convert the file into a C++ but when it asked me to specify the "cross compiler prefix" and "cross compiler path", I don't know what to put. Therefore, I cannot run the program. I appreciate if anyone could help me with this![
    Last edited by Salem; 10-01-2013 at 11:42 PM. Reason: font abuse

  2. #2
    11DE784A SirPrattlepod's Avatar
    Join Date
    Aug 2013
    Posts
    485
    My advice is to concentrate on Problem #1 first (you're required to write pseudocode not C++!)

    But I suppose you will want to have a C or C++ compiler at some point (are you sure that your course uses C++ and not C?)

  3. #3
    Registered User
    Join Date
    Oct 2013
    Posts
    3
    In fact, I have an assignment for tomorrow to hand in and they are both asked in the assignment, in different sections. I have to write a pseudocode for what I mentioned but the C++ program is required for another part. I would thank you if you could help me how to do these two, considering with my very little knowledge!

  4. #4
    11DE784A SirPrattlepod's Avatar
    Join Date
    Aug 2013
    Posts
    485
    Well, for the psuedocode write down every single step you must take to solve the problem. Like a recipe.

    Perhaps Eclipse is overkill for what you need (I don't actually know if it's overkill, but I suspect). Have you tried xcode? It might be overkill as well, but it's probably easier to set up

  5. #5
    Registered User
    Join Date
    Oct 2013
    Posts
    3
    Quote Originally Posted by SirPrattlepod View Post
    Well, for the psuedocode write down every single step you must take to solve the problem. Like a recipe.

    Perhaps Eclipse is overkill for what you need (I don't actually know if it's overkill, but I suspect). Have you tried xcode? It might be overkill as well, but it's probably easier to set up
    Yeah, I found the XCode stuff on the web; I am trying it now.
    But for the pseudo-code, I know how it should be but I don't know how to write it for this specific question. So far, I have written the following:

    1. Prompt the user to enter a number (n)
    2. Read the input (n)
    3. Compute n/10 if n>9
    4. Compute d = n%10
    5. Display d as the last digit of the number


    So, that's for the last digit and I am still left with the first digit and don't know how to compute it. Do you have any ideas?

  6. #6
    11DE784A SirPrattlepod's Avatar
    Join Date
    Aug 2013
    Posts
    485
    Ok, that will give you the last (rightmost) digit.

    The rest is general programming skills.

    Hints:
    You'll probably need a loop
    Question: Can you work out how to print the last and the second last digit (e.g. given 123456 print 6 and then 5?)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pseudo Code
    By BretFlorida in forum C Programming
    Replies: 2
    Last Post: 04-15-2013, 04:13 PM
  2. Please help me on my simple program PSEUDO RANDOM NUMBERS
    By metaljacob in forum C Programming
    Replies: 21
    Last Post: 09-16-2010, 09:31 AM
  3. Pseudo Code (Please Help)
    By slimdime in forum C++ Programming
    Replies: 1
    Last Post: 09-05-2010, 10:47 AM
  4. producing c/c++ code from flowcharts,pseudo code , algorithims
    By rohit83.ken in forum C++ Programming
    Replies: 3
    Last Post: 02-20-2008, 07:09 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21