0
#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

Edited by mike_2000_17: Fixed formatting

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Fbody
0

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.

0

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....

Edited by Fbody: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.