Hmmm, nope. Still failing O.o
Are you kidding?
What are the error messages?
Correction, no error messages aside from the ones that get triggered directly in the code
Unable to create OpenGL Context
Unable to recreate GLFW Window
Failed to open GLFW window
...
GLFWvidmode vm;
glfwGetDesktopMode(&vm);
// Open a window and create the OpenGL context
if(!glfwOpenWindow(800, 600, vm.RedBits, vm.GreenBits, vm.BlueBits, 0, 0, 0, GLFW_WINDOW)) {
fprintf(stderr, "Failed to open GLFW window!\n");
glfwTerminate();
return 2;
}
...
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <fstream>
#include <sstream>
#include <map>
using namespace std;
class ReadGameFile {
public:
string line;
fstream file;
int count;
string args[7];
void enterDetails (){
for (count = 0; count <= 6; count++){
if (count == 0){ cout << "Please enter name: "; getline(cin, args[count]); }
else if (count == 1){ cout << "Please enter age: "; getline(cin, args[count]); }
else if (count == 2){ cout << "Please enter weight: "; getline(cin, args[count]); }
else if (count == 3){ cout << "Please enter class: "; getline(cin, args[count]); }
else if (count == 4){ cout << "Please enter race: "; getline(cin, args[count]); }
else if (count == 5){ cout << "Please enter hair color: "; getline(cin, args[count]); }
else if (count == 6){ cout << "Please enter pant size: "; getline(cin, args[count]); }
}
readFile();
}
void readFile (){
file.open("Rebels_after_start.txt");
while(file.good()){
getline(file,line);
repTags(line, args);
cout << line << '\n';
}
file.close();
}
void repTags(string &line, string args[]){
static map<int,string> tags;
size_t pos = 0;
tags[0] = "/NAME/";
tags[1] = "/AGE/";
tags[2] = "/WEIGHT/";
tags[3] = "/CLASS/";
tags[4] = "/RACE/";
tags[5] = "/HAIR-COLOR/";
tags[6] = "/PANT-SIZE/";
for (count = 0; count <= 6; count++){
while ( (pos = line.find(tags[count])) != string::npos){
line.replace(pos, tags[count].size(), args[count], 0, args[count].size());
pos += args[count].size() + 1;
}// while
}//for
} // mapTEXT FUNCTION
}; // ReadGameFile CLASS
int main (){
ReadGameFile game;
game.enterDetails();
return 0;
}
Hello Commander Shepard, you're looking mighty spry for a infiltrator of 26 years.
I see you are still dying your hair (I don't have any hair... :/), which is mightily becoming of a human like yourself.
You're putting on a few pounds, however. You look like you weigh about 70 lbs, and your belly is bulging out quite alot. Is that a size 32 pantaloons you are wearing?
You need to get into shape before your journey, Commander Shepard, if you don't mind me pointing out the obvious.[/quote]
Now, I want to ask is there any other way to optimize the code and make it faster/better/more readable/more efficient?
If, so can you propose some ideas?
Again thanks a lot.