Caculate the value of i after each step
int x=2, y=x+30;
struct A{
static int x;
int y;
public:
operator int( ){ return x+y; }
A operator ++(int){ return A(x++, y++); }
A(int x=::x+2, int y=::y+3){ A::x=x; A::y=y; }
int &h(int &x);
};
int &A::h(int &x)
{
for(int y=1; y!=1 || x<201; x+=11, y++)
if(x>200) { x-=21; y-=2;}
return x-=10;
}
int A::x=23;
void main( ){
A a(54, 3), b(65), c;
int i, &z=i, A::*p=&A::y;
i=b.x; //.................................¢Ù
z=a.x; //.................................¢Ú
i=c.*p; //.................................¢Û
i=a++; //.................................¢Ü
i=::x+c.y; //.................................¢Ý
i=a+b; //.................................¢Þ
b.h(i)=7; //.................................¢ß
}
and another one, write down the ouput of this program
#include <iostream.h>
struct A{A( ){ cout<<'A';}};
struct B{B( ){ cout<<'B';}};
struct C: A{C( ){ cout<<'C';}};
struct D: virtual B, C{D( ){ cout<<'D';}};
struct E: A{
C c;
E( ): c( ){ cout<<'E';}
};
struct F: virtual B, C, D, E{
F( ){ cout<<'F';}
};
void main( ){
A a; cout<<'\n';
B b; cout<<'\n';
C c; cout<<'\n';
D d; cout<<'\n';
E e; cout<<'\n';
F f; cout<<'\n';
} 4 1084 jo*****@gmail.com wrote:
Caculate the value of i after each step
[..]
Aside from the use of global variables (which has its place),
and 'void main', what's your objection? Is it too easy? Too hard?
Did you find that you could do it, but most couldn't? What?
and another one, write down the ouput of this program
[..]
Again, 'void main', and the use of an obsolete header <iostream.h>.
So? Did you solve it? It's not that difficult, and I am *sure* it
addresses just the topics your course contained.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask jo*****@gmail.com wrote:
struct A{
static int x;
int y;
public:
operator int( ){ return x+y; }
A operator ++(int){ return A(x++, y++); }
A(int x=::x+2, int y=::y+3){ A::x=x; A::y=y; }
int &h(int &x);
};
LOL @ struct A. It is written as x and y are private.
Easy exam, wasn't it?
On 2007-07-03 09:54, anon wrote:
jo*****@gmail.com wrote:
>struct A{
static int x;
int y;
public:
operator int( ){ return x+y; }
A operator ++(int){ return A(x++, y++); }
A(int x=::x+2, int y=::y+3){ A::x=x; A::y=y; }
int &h(int &x);
};
LOL @ struct A. It is written as x and y are private.
Easy exam, wasn't it?
Maybe, but you failed. Since it's a struct all members are public by
default, so x and y are public, and the 'public:' is unnecessary.
--
Erik Wikström
Erik Wikström wrote:
On 2007-07-03 09:54, anon wrote:
>jo*****@gmail.com wrote:
>>struct A{
static int x;
int y;
public:
operator int( ){ return x+y; }
A operator ++(int){ return A(x++, y++); }
A(int x=::x+2, int y=::y+3){ A::x=x; A::y=y; }
int &h(int &x);
}; LOL @ struct A. It is written as x and y are private.
Easy exam, wasn't it?
Maybe, but you failed. Since it's a struct all members are public by
default, so x and y are public, and the 'public:' is unnecessary.
I might have expressed myself wrongly, but read again what I wrote. To
me it looks like whoever wrote it expected x and y to be private. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Vanessa BJ |
last post by:
Hi. I am an amateur Java enthusiast. I currently work as a carpenter
and I moonlight on the weekends as a photographer. I'm trying to
transition a career change.
Which Java exam should I start...
|
by: who be dat? |
last post by:
I'm currently taking an online class for SQL Server which is aimed at
teaching you the information you need to pass exam #70-229. However,
concerns exists on my part on how good this web based...
|
by: Tammy |
last post by:
Please accept my apologies for asking a question that probably has
already been asked a thousand times. I tried doing a search but
everyone puts generic titles to their articles on the Access MOUS...
|
by: pankaj_wolfhunter |
last post by:
Greetings,
I want to appear for DB2 UDB V8.1 for Linux, UNIX and Windows Database
Administration (Exam 701) certification.
Right now i am referring to the tutorial given in the IBM site for the...
|
by: Wee Bubba |
last post by:
hello.
I have decided to study for my MCAD qualifications. I am definetely
going to do a core exam in "Developing Web Applications With C#". I
am also doing a core exam in "Developing XML...
|
by: Vanessa BJ |
last post by:
Hi. I am an amateur VB.net enthusiast. I currently work as a carpenter
and I moonlight on the weekends as a photographer. I'm trying to
transition a career change.
Is there an exam that leads to...
|
by: mike_li |
last post by:
Passed DB2 UDB 701 test, how can I prepare for 704 test (Advanced DBA)?
There is not as many info. on this test as on others.
Thanks.
Mike
|
by: derekbarrett |
last post by:
Hi,
I found this article in DB2 magazine and learned about the Problem
Determination Mastery Exam. I am very interested in taking the exam,
however, following the links in the article leads to...
|
by: Sujath |
last post by:
Hi does anyone have dumps for Exam 70-553 and Exam 70-554
If so please sent me to this mail id sujath@gmail.com
Thanks in Advance
Regards
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |