Categories
Uncategorised

Structures – Returning Reference to a Structure

/* Copyright (C) 2007 Ankur Banerjee. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. http://www.fsf.org/licensing/licenses/lgpl.html /

/ Function returning reference to a structure – WAP to add distances
entered in feet and inches /

#include <iostream.h>
#include <conio.h>

struct dist
{
int feet, inches;
} result;

void main()
{
clrscr();
dist d1, d2;
dist& add (dist&, dist&);
cout<<“Enter first distance : “;
cin>>d1.feet>>d1.inches;
cout<<“Enter the second distance : “;
cin>>d2.feet>>d2.inches;
result = add(d1, d2);
cout<<“Added result is “<<result.feet<<” feet ” <<result.inches<<” inches”<<endl;
getch();
}

dist& add (dist &a1, dist &a2)
{
dist res;
res.feet = (a1.feet + a2.feet) + ((a1.inches + a2.inches)/12);
res.inches = (a1.inches + a2.inches)%12;
return res;
}

/ Output */

Enter first distance :6
5
Enter
the second distance :8
2
Added result is 14 feet 7 inches

Categories
Uncategorised

The shit starts…now!

Sigh. I’m SO depressed. 47 days of shit start right now.

It’s just that I find cricket BORING. Never really seen many (any?) cricket matches. The last time was during the last World Cup, India vs Holland, when one of my friends in my old school won a Pepsi contest in which kids got to lead the team to field for the toss. Unfortunately for him, Pepsi had forgotten to tell the international TV feed team to cover him (they though he was some security chap or something), so we never got to see him, but the South African feed did have him. Oh well, I never saw the match, closed the TV right then.

So while the media, and people go gaga over cricket, I’ve got nothing else to do but get bored. I mean, why the fascination? Not that out team does well (from the headlines in sports section).

And no, I don’t hate sport. I follow soccer, not boring cricket!