hey I am new in C++ and I have finished my code but my Prof. asked me to write pseudocode and I have no idea what that is and I dont know how to write it. Can somebody give me some example how to write pseudocde from this code.

//This program will calculate the monthly payment on a loan.

    #include <iostream>
    #include <iomanip>
    #include <cmath>
    using namespace std;

int main() {
   
    double payment, rate, n, l;

    cout << "Please enter your interest rate: ";
    cin >> rate;
    rate /= 12; // or rate = rate / 12;
    cout << "Please enter the number of payments: ";
    cin >> n;
    cout << "Please enter the amount of the loan: ";
    cin >> l;
    payment = rate * pow(1 + rate, n) / (pow(1 + rate, n) - 1) * l;
    cout << "Loan Amount: $"<< l << endl;
    cout << "Monthly Interest Rate: "<< rate << "%" << endl;
    cout << "Number of Payments: "<< n << endl;
    cout << "Monthly Payment: $"<< payment << endl;
    cout << "Amount Paid Back: $"<< n * payment << endl;
    cout << "Interest Paid: $"<< n * payment - l << endl;

    return 0;
}

Thanks

hey I am new in C++ and I have finished my code but my Prof. asked me to write pseudocode and I have no idea what that is and I dont know how to write it.

Well, in my opinion, you should have ask him this when he told you to do it.

But, in lieu of that, pseudo code is describing what the program does in a (Pick Your Native Language)-like manner.

Thing like:
1) Input the values for height and width.
2) Calculate the area with (height * width) / 2 3) Display the result

Just thought of something. If you don't know anything about it and your Prof never taught you, how did you know is was spelled pseudocode? :icon_wink:

1. use code tags.
2. if you are being asked for pseudocode then i am guessing your prof doesn't think you are ready for the actual code yet.
3. is this your code?
4. google.

edit: it just appeared in code tags
3. i.e can you explain what the code is doing?

I know how it spelled coz it was on the assignment paper.
where do I write pseudocode? on piece of paper or on C++?
can you explain more detail please.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.