and before I knew it created this:
CE Registration Program
Compiling details of available participants
for Puppy Community Edition
Here is the code:
Code: Select all
/*
CE Registration
Compiling details of available participants
for Puppy Community Edition
* Lobster Sep 2009
*/
#include <iostream.h>
#include <fstream.h>
using namespace std;
int main ()
{
/////////////// Welcome
system("clear");
cout << "== Community Edition Registration == \n\n"; // This lets us show a message
string web_name;
cout << "Enter your Web Name: ";
getline (cin, web_name);
cout << "\nHi ";
cout << web_name ;
cout << "\nThis program will collect some details \n to help us compile talents \n for the Puppy CE editions \n\n" ;
/////////////// Questions
system("clear");
string skills_offered, contact_details, misc_info ;
cout << "What Puppy Skills are you offering? \n eg. Coordinating, programming, compiling, testing, maintaining wiki, hosting, artwork, \n\n Type them in (separated by commas): ";
getline (cin, skills_offered);
system("clear");
cout << "How do you prefer to be contacted? \n eg. forum (provide forum name), email (address)\n Type in contact details: ";
getline (cin, contact_details);
system("clear");
cout << "Any other Info? ";
getline (cin, misc_info);
/////////////// Create file
ofstream myfile ("registration.txt");
if (myfile.is_open())
{
myfile << "Puppy Details for ** ";
myfile << web_name ; //add variable write
myfile << " **\n\n";
myfile << "Skills offered: ";
myfile << skills_offered ; //add skills
myfile << " \n";
myfile << "Contact Details: ";
myfile << contact_details ; //add skills
myfile << " \n";
myfile << "Misc Info: ";
myfile << misc_info ; //add skills
myfile << " \n\n\n";
myfile << " Please send 'registration.txt to ed.jason@gmail.com \n or add details to wiki \n http://puppylinux.org/wikka/Puppy44 " ;
myfile.close();
}
else cout << "Unable to open file";
/////////////// Thanks and Bye
system("clear");
cout << "\nOK ";
cout << web_name ;
cout << "\nA text file called 'registration.txt' \n has been created, which you can edit \n Please send 'registration.txt to ed.jason@gmail.com \n or add details to wiki \n http://puppylinux.org/wikka/Puppy44 \n" ;
system("defaulttexteditor registration.txt");
return 0; // Quits the program
}
run the program from the terminal
Code: Select all
# ./cereg
Yuk!
Luckily the most ridiculous aspect of C (atrocious string handling)
has been rectified
What I have learned so far:
C++ in easy steps is the book I used
but loads of great tutorials on the web
Make sure you have devx.sfs
Geany is GREAT as an IDE for C++
and it is in Puppy 4.3
compile and then build
and then run from the terminal with
Code: Select all
./myfirstprog.cpp
Quite often C++ wouldn't work
I looked up examples until something worked
my code uses old commands
but it compiles