200 fg. which I don't have yet but I bought it through paypal and apparently d2jsp has to validate my payment
I fucking hate c++. need full working syntax. this honestly should only require a few lines of code. it must use the class I defined.
the program must prompt the user for the name of the song and then print the information for that song. (name, artist, duration.)
offer is valid for one hour
song.h:
Code
#include <iostream>
using namespace std;
class Song
{
private:
string name;
string artist;
int duration;
public:
Song()
{
name = "";
artist = "";
duration = 0;
}
void setVars( string, string, int );
string getName();
string getArtist();
int getDuration();
void Print();
};
song.cpp:
Code
#include "Song.h"
void Song::setVars( string x, string y, int z )
{
name = x;
artist = y;
duration = z;
}
string Song::getName()
{
return name;
}
string Song::getArtist()
{
return artist;
}
int Song::getDuration()
{
return duration;
}
void Song::Print()
{
cout << "Name: " << name << endl;
cout << "Artist: " << artist << endl;
cout << "Duration: " << duration << "s" << endl;
}
main.cpp:
Code
#include <cstdlib>
#include <iostream>
#include "Song.h"
#include <vector>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
vector <Song> songVec;
vector<Song>::iterator it;
Song a, b, c, d, e, f, g, h, i, j;
songVec.push_back(a);
songVec[0].setVars("LK", "DJ Marky", 224);
songVec.push_back(b);
songVec[1].setVars("Fate or Faith", "Ror Shak", 374);
songVec.push_back(c);
songVec[2].setVars("1901", "Phoenix", 204);
songVec.push_back(d);
songVec[3].setVars("Hold Your Colour", "Pendulum", 236);
songVec.push_back(e);
songVec[4].setVars("Karma", "Guru", 315);
songVec.push_back(f);
songVec[5].setVars("Property Is Theft", "Klute", 387);
songVec.push_back(g);
songVec[6].setVars("Streetlife", "Chase & Status", 260);
songVec.push_back(h);
songVec[7].setVars("Escape", "Netsky", 172);
songVec.push_back(i);
songVec[8].setVars("Red Mist", "Danny Byrd", 256);
songVec.push_back(j);
songVec[9].setVars("Move For Me", "Kaskade", 279);
string songName;
cout << "Enter song name: ";
cin.ignore();
getline( cin, songName );
//print the song information for the song which has been inputted.
system ("PAUSE");
return EXIT_SUCCESS;
}
This post was edited by Aimed_Shot on Jul 5 2012 01:28pm