Hi
I'm new, and a student who is oddly enough a little stumped. Not being doing C++ for long so I probably have a lot of Bad Code and it probably looks ugly to anyone who has been doing it for a few months. I've noticed around here that using namespace std etc isn't exactly good practice but if I take a code back to my tutor without it I'll get sent back to change it and put it back in. So just to explain why I'm using it, I'm keeping a note in my head that outside of my classroom it isn't a good idea. So now I'm done apologising for this, I'll get to why I've been up till 3am.

For the life of me, I can't work out how to call the plant with the longest Latin name. I've been at it for a few hours.

As I'm a student, and I'm very much pointing this out so no one accuses me down the line of getting other people to do my homework! I'm not expecting someone to turn up and give me the exact code to fix my problem. Being pointed in the right direct or given a bit of code I could work with would be awesome.

Thank you for taking time out to read this, and double thanks for any help!



Code:
// Session6_4.cpp : Defines the entry point for the console application.
//For you to do...

#include "stdafx.h"
#include <iostream>
#include <iomanip> 
#include <string>
using namespace std;

const int MAXPLANTS =6; //Always use this instead of magic numbers in code!

struct Plants
{
	string CommonName;
	string LatinName;
	double Height;
	double Price;
};

int main()
{

	Plants ListPlants[MAXPLANTS] = 
	{	
								{"Bluebell",				"Endymion Non Scripta",			0.3,	1.25},
								{"Snowdrop",				"Galanthus Nivalis",			0.15,	1.55},
								{"Tenby Daffodil",			"Narcissus Obvalis",			0.4,	3.25},
								{"Winter Aconite",			"Eranthis Hyemalis",			0.1,	2.0},
								{"Dogs Tooth Violet",		"Erythronium Dens Canis",		0.15,	5.95},
								{"Summer Snowflake",		"Leucojum Aestivum",			0.3,	4.50}
	};

	
	int IndexMostExpensive;
	double PriceMostExpensive;

	IndexMostExpensive=0;
	PriceMostExpensive = ListPlants[IndexMostExpensive].Price; 

	///Header Display///

	cout<<setfill(' ')<<setw(20)<<"Common Name"<<(' ')<<setw(20)<<"Latin Name"<<(' ')<<setw(20)<<"Height"<<(' ')<<setw(10)<<"Price"<<endl<<endl;

	for (int i=0;   i<MAXPLANTS;    i++)
	{
		//cout<<ModelName[i]<<"\t"<<Registration[i]<<"\t"<<Price[i]<<"\t"<<EngineSize[i]<<endl;
		cout<<setfill(' ')<<setw(20)<<ListPlants[i].CommonName;
		cout<<setfill(' ')<<setw(30)<<ListPlants[i].LatinName;
		cout<<setfill(' ')<<setw(10)<<ListPlants[i].Height;
		cout<<setfill(' ')<<setw(10)<<ListPlants[i].Price;
		cout<<endl<<endl;


			if (ListPlants[i].Price>PriceMostExpensive)
		{
			IndexMostExpensive =i;			
			PriceMostExpensive = ListPlants[i].Price; 
		}
			
	}

	cout<<endl<<"Most expensive Plant is "<<ListPlants[IndexMostExpensive].CommonName<<" at a price of "<<ListPlants[IndexMostExpensive].Price<<endl;
	cout<<"The Latin name being "<<ListPlants[IndexMostExpensive].LatinName<<" and a height of "<<ListPlants[IndexMostExpensive].Height<<endl;
	return 0;
}