cout << "\nMember: " + theparent->objectName() + " - Parent: " + theparent->parent()->objectName();
}
So I haven’t programmed in two weeks. The C++ book is still pegged to the second section. I know I have to finish what I started before the next semester starts. This unfinished work reminds me of the many things that I have left behind hoping that I will pick up ‘next time’, when I have the time. This work hangs like unfinished sentence, and I count on.
Moving on, I am spending my first summer in la belle province. The Quebec society is more vibrant, dynamic and communal. The biggest challenge is french, which is not hard. French is ellusive and takes time to get the hang of, like any other language.
My objectives for the summer are to get in shape, save money and study. As to exploring the Montreal island, that thought still lingers. I want to, but I do not have the time.
I try to keep my posts impersonal. The only I am posting this because I have a big day tomorrow. I rarely have big days, but I have the 9th of June 2010 as my big day.
Tags: citizenship, quebec
A quick note on Facebook:
A lot of blogging has been going on about how privacy settings have been rigged in favor of Facebook vs User. While outrage should be expected, rationale should also be coupled with that outrage. The rationale is understood using the web unknowns.
Web unknowns:
1. Any transaction over the internet is public.
People should not expect anonymity and privacy whilst they are on the internet. The truth is that what ever you place on the internet is public.
User names and passwords only identify you, they do not provide privacy.
2. Once your device is connected to the internet you are being tracked.
Every website that you visit identifies by your Internet Protocol address, takes note of what web page you are coming from. For example, who referred you, was it google or yahoo etc. It will identify your browser and your Operating System.
This helps to either serve you better or to show you ads tailored to you or even track you down.
So should you expect privacy in a public place?
Facebook and others like Yahoo have said no. Information that you provide to website like these has allegedly been sold to Marketing companies, CIA and whosoever has a good price.
In light of that I am not suggesting you run for the hills. I suggest that you protect yourself.
How?
You can use hostEditor free of charge and block access to websites that track you.
You should not post anything online or in an email that you do not want public.
using namespace std;
void change(int a);
int main(int argc,char *argv[]){
double purchaseAmount = 0.0;
double payment = 0.0;
int totalChange = 0;
cout << "\nEnter purchase amount :\t";
cin >> purchaseAmount;
cout << "\nEnter Payment :\t";
cin >> payment;
totalChange = (payment * 100)-(purchaseAmount * 100);
cout << "Total change is :\t"<<(payment - purchaseAmount)<<endl;
change(totalChange);
return 0;
}
void change(int a){
int hundred = a / 10000;
a %= 10000;
int fifty = a / 5000;
a %= 5000;
int twenty = a / 2000;
a %= 2000;
int ten = a / 1000;
a %= 1000;
int five = a/ 500;
a %= 500;
int two = a / 200;
a %= 200;
int dollar = a / 100;
a %= 100;
int twentyFiveCents = a / 25;
a %= 25;
int tenCents = a / 10;
a %= 10;
int fiveCents = a / 5;
a %= 5;
int cent = a / 1;
if(!(hundred <=0)){
cout << "\n\t\t\t $100 : "<< hundred <<endl;
}
if(!(fifty <=0)){
cout << "\n\t\t\t $50 : "<< fifty <<endl;
}
if(!(twenty <=0)){
cout << "\n\t\t\t $20 : "<< twenty <<endl;
}
if(!(ten <=0)){
cout << "\n\t\t\t $10 : "<< ten <<endl;
}
if(!(five <=0)){
cout << "\n\t\t\t $5 : "<< five <<endl;
}
if(!(two <=0)){
cout << "\n\t\t\t $2 : "<< two <<endl;
}
if(!(dollar <=0)){
cout << "\n\t\t\t $1 : "<< dollar <<endl;
}
if(!(twentyFiveCents <=0)){
cout << "\n\t\t\t 25c : "<< twentyFiveCents <<endl;
}
if(!(tenCents <=0)){
cout << "\n\t\t\t 10c : "<< tenCents <<endl;
}
if(!(fiveCents <=0)){
cout << "\n\t\t\t 5c : "<< fiveCents <<endl;
}
if(!(cent <=0)){
cout << "\n\t\t\t 1c : "<< cent <<endl;
}
}
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
int diceThrow();
void result(int a);
void lostThrow(int a);
int choice = 0;
int whileLoop = 0;
int main(int argc,char *argv[]){
while(whileLoop == 0){
cout << "Let\'s play dice\n"
"Press 1 to exit or 2 to throw the dice\n";
cin >> choice;
switch(choice){
case 1:
whileLoop = 1;
break;
case 2:
result(diceThrow());
break;
default:
cout<<"\n\t\t**Invalid choice**\n\n";
}
}
return 0;
}
int diceThrow(){
srandom(time(0));
int diceA = random() % 6 + 1;
int diceB = random() % 6 + 1;
cout << "Dice 1 : "<< diceA <<"\tDice B: "<<diceB<<endl;
return (diceA+diceB);
}
void result(int a){
if((a == 7) || (a == 11)){
cout <<"\n\t*************You win***********\n";
}else if(a == 2){
cout<<"\n\tYou lose\n";
}else{
cout <<"\nTry again no luck\n\n";
lostThrow(a);
}
}
void lostThrow(int a){
int d = 0;
int whileLoopIn = 0;
while(whileLoop == 0){
cout << "Let\'s play dice\n"
"Press 1 to exit or 2 to throw the dice\n";
cin >> choice;
switch(choice){
case 1:
whileLoop = 1;
break;
case 2:
d = diceThrow();
if (a==d){
cout<<"\n\t***You win***\n";
whileLoopIn = 1;
}else if((d==7)||(d==11)){
cout<<"\n***You Lose ***\n";
whileLoopIn = 1;
}
break;
default:
cout<<"\n\t\t**Invalid choice**\n\n";
}
}
}
Tags: C++, if statement, switch statement