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?
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];
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. ;-)