Jump to content
  • Advertisement
Sign in to follow this  
JWColeman

Unity Getting Back into the swing of things.

This topic is 2525 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I decided to start writing an employee database program, something simple to get me re-familiarized with syntax, here's what I have so far.

[source]

// Experimentations.cpp : main project file.

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



struct employee
{
string name;
string payrate;
};

vector<employee> employees;

void edit(employee a)
{
string input;
int selection;
bool goodinput = false; //loop conditional, input must match conditions, else continue
while (goodinput == false)
{
cout << "What would you like to change?" << endl // prompt
<< "1. Name" << endl << "2. Payrate" << endl;

getline(cin, input); //get input
stringstream(input) >> selection; //extract selection integer

if (selection == 1)
{
goodinput = true;
cout << "Please enter a name for this employee: ";
getline(cin, a.name);
}
else if (selection == 2)
{
goodinput = true;
cout << "Please enter a pay rate for this employee (hourly): ";
getline(cin, a.payrate);
}
else
{
goodinput = false; // invalid selection - continue loop
cout << "Please enter a valid selection, 1 or 2." << endl;
}
}
}
int main()
{
employee johnsmith;
cout << "Welcome to the employee database." << endl;
return 0;
}


[/source]

Nothing fancy, and I don't really have any particular questions yet, just kind of reintroducing myself to the community after a long leave. Hey GDNet! Anyone have any brilliant ideas I might want to try to implement for practice?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!