#include <iostream>
#include <string>
using namespace std;

int main() {
    //Declaring values.
    string oneWord, twoWord, threeWord, fourWord, fiveWord, fullWord;
    //Assigning values
    oneWord = "One";
    twoWord = "Two";
    threeWord= "Three";
    fourWord = "Four";
    fiveWord = "Five";

    //  Now we will define the full word
    fullWord = oneWord + ", " + twoWord + ", " + threeWord + ", " + fourWord + ", " + fiveWord;

    cout << fullWord <<".\n";

This is the program I have written I know it is simple but I have no programming experience and my professor is no help, I need it to print out backwards if that makes any sense so instead of one, two, three, four, five. I need it to be five, four, three, two, one. I believe it takes sometype of loop but I am not sure on how to do it. any help would be greatly appreciated. Thanks in advance. John

Hi,

Put your code in code tags, it helps when reading.

The answer is staring you in the face.

fullWord = oneWord + ", " + twoWord + ", " + threeWord + ", " + fourWord + ", " + fiveWord;

Change the order of that to get your answer.

Please figure out your [code] ...code tags... [/code], then maybe we can help.

#include <iostream>
int main() {
  std::cout << "This looks nice, and is easily readable." << std::endl;
  return 0;
}

#include <iostream>
int main() {
std::cout << "This looks like dung, and isn't readable." << std::endl;
return 0;
}

Oh, and what kes said too....

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.