Hi.
BEFORE YOU THINK I AM JUST GETTING SOMEONE TO DO MY WORK, SCROLL DOWN AS I HAVE MADE A VERY GOOD ATTEMPT AND AM RECEIVING ERRORS!
Basically i am fairly new to C++ and have been given a small class exercise to do for home work and am struggling to make it happen.
Basically i need to make a program which asks the user to enter messages, along with the time they inputted it ( hours, minutes, seconds) and then displays them at the end of the program.
We have to use structures and dynamic arrays in the exercise, so the program should run as:
* Prompt user for how many messages they want to input
// store that as the array
* Enter that amount (initally inputted) of messages as follows:
message: sdfsdfsdfsdfs
// for the time the user is to enter it manually
x hours
x minutes
x second
Once all messages and time have been displayed they are to be displayed, an example is as follows:
Enter amount of messages: 3
Messages received:
i love C++
2 hours
35 minutes
10 seconds
This subject is hard
4 hours
5 minutes
14 seconds
Please help me
6 hours
33 minutes
54 seconds
NOW HE IS MY ATTEMPT AT THE PROGRAM
As mentioned i am very new to this and may have many errors therefore any advice would be greatly appreciated
#include <iostream>
using namespace std;
struct messages
{
string message;
int hours;
int minutes;
int seconds;
};
int main()
{
int size;
int value;
int* array;
cout << "How many numbers?";
cin >> size;
array = new messages[size];
for (int i = 0; i < size; i++)
{
cout << "Input " << i+1 << ": " << endl;
cin >> value;
array[i].messages = value;
}
cout << "Message Recieved were: ";
for (int j = (size-1); j >= 0; j--)
{
cout << array[j].messages << " ";
}
return 0;
}
If you would like to assist me you can simply reply to this thread or better yet contact me at (snip) either by email or msn
Many Thanks