Need Help with C++

I just started C++. I have to write a program where user is asked to enter multiple variables in the same line, I searched everywhere i couldn't find it can someone please tell me how to write the program?
#include <iostream>
using namespace std;
int main()
{
int a,d,c;
cin>>a>>d>>c;
cout<<"entered values\n";
cout<<a<<"\n";

cout<<d<<"\n";

cout<<c<<"\n";
return 0;
}
:)
Thx, but my teacher told me to use something like array command, so if u could gimme the program for that.

If you can tell us what an array is, and show code to make one, I'll give you some code.
not exactly sure but, he said it is used to enter multiple variable at the same time.

so the program is like this The program is a music proram. It is asking the user to enter notes. so all th enotes they will enter will be in one line.

hope this helps
Ok, if you just want to enter the integers on one and the same line, and after that to store them in a vector, use cin, after that push.back?Or you want something different?
Ok, I am going to explain the whole program properly.

First this is what I have to do. I have to make a program where I have 2 or 3 songs (used beep function of the c++ and turned all the notes in to frequency) Now The program will be like this, the user picks a song first, than the program will teach them how to play the song. basically so, the program will show the notes, and the user will enter them (technically copy them). and once they enter them the program will output the sounds of the notes they entered.

Now my teacher told me to use a function called array to sort out the notes, here is an example,

#include<iostream>

using namespace std;
int main()
{
/* Declare array to hold expenses */
float expenses[12];

/* Input data from keyboard into array */

for (int count = 1; count < 13; count++)
{
cout <<"Enter expenses or month " << count << ": ";
cin >> expenses[count];
}

for (int count = 1; count < 13; count++)
{
cout << "Month " << count << " = $" << expenses[count] << endl;
}
system ("pause>nul");
return 0;
}


Hope thishelped. PLease reply ASAP.
http://www.cplusplus.com/doc/tutorial/arrays/
Everything you ever wanted to know about what your teacher wants you to do.
A C++ array is not a function, it's a collection of similar datatypes (ints, strings, etc.). You use functions on arrays to manipulate them (e.g.: sort them).

Now why would you want to sort an array of integers that represent musical notes??? Sorting them would turn any song into a sequence of increasingly higher tones. It wouldn't be a song anymore. I think you need to get the assignment straight with your teacher before anything else.

BTW, I suspect your teacher expects you to write this code yourself so you'll learn something rather than asking a C++ forum to "gimme the program for that". Just saying. ;-)

Also, I don't know where you searched for information about arrays but apparently it wasn't right here: http://www.cplusplus.com/doc/tutorial/arrays/

Read that page and then come back if you have any specific questions...
I guess the teacher wanted you to store the notes of the song into an array instead of using several variables.
1
2
3
4
5
6
7
string song[5000]; // song array to hold notes
song[0] = "E";
song[1]= "D";
song[2] = "F";
.
.
.


As you said the program will teach how to play the song then you will have to initialize the song array with notes like...
 
string song[5000] = {"D","F","E",...};
Topic archived. No new replies allowed.