What I'm interested in right now is trying to create a user-driven database:
the user inputs series' of data containing forenames, surnames, dob's and titles (Mr, Mrs, or Ms). I will also try figuring out how to perform validation checks of said data that gets inputted. I will also try getting the C++ program I write to do this job, to also write this data to a file (name of which is specified by the user), and have an option to read from a file with this recorded data. Still, I've only recently got into C++, so it will take a while until I'm able to write a program like this.
Well, basically I am starting to *really* like programming, much more so than when I first tried to learn how to write code.
Anyway, the program below isn't exactly complex or anything (and doesn't do anything useful), but it's the first *actual* program that I have *ever* written in C++:
Code: Select all
#include <iostream>
using namespace std;
int main()
{
int num;
int loop;
int lowest;
int highest;
cout << "Enter number (0 to finish): ";
cin >> num;
if ( num == 0 ) {
return 0;
}
highest = num;
lowest = num;
cout << "Enter number (0 to finish): ";
cin >> num;
if ( num == 0 ) {
return 0;
}
else if ( num > highest ) {
highest = num;
}
else if ( num < highest ) {
lowest = num;
}
cout<<"Lowest number "<< lowest <<" and highest number "<< highest <<"\n";
loop = 1;
while ( loop == 1 ) {
cout << "Enter number (0 to finish): ";
cin >> num;
if ( num == 0 ) {
return 0;
}
else if ( num < highest ) {
if ( num == 0 ) {
return 0;
}
else if ( num < lowest ) {
lowest = num;
}
}
else if ( num > lowest ) {
if ( num == 0 ) {
return 0;
}
else if ( num > highest ) {
highest = num;
}
}
cout<<"Lowest number "<< lowest <<" and highest number "<< highest <<"\n";
}
cin.get();
}