60 322
Assignments Done
98%
Successfully Done
In April 2018

Answer to Question #56518 in C++ for Benjamin Amoasi

Question #56518
Write a simple application that accept 5 names from a user, and prints the names out in the reverse order. example Ben,Amavi,Peace,Amoo,Nester. Should be printed out as Nester,Amoo,Peace,Amavi and Ben.(Note use function to implement this program)
Expert's answer
using System;

namespace ReverseNamesOrder
{
class Program
{
static void Main(string[] args)
{
string[] names = new string[5];

// Read names
Console.WriteLine("Enter five names, please. One by line.");
for (int i = 0; i < 5; i++)
{
names[i] = Console.ReadLine();
}

// Write reverse order
Console.WriteLine();
Console.WriteLine("Reverse order: ");
for (int i = 4; i >=0; i--)
{
Console.WriteLine(names[i]);
}

// Delay
Console.ReadKey();
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions