Question about Microsoft Computers & Internet

1 Answer

The size of an empty class in c++ is one.Why?Illustrate? class A {} void main() { cout<<

Posted by on

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    MVP:

    An expert that gotĀ 5 achievements.

    Sergeant:

    An expert that hasĀ over 500 points.

    Champion:

    An expert who has answered 200 questions.

  • Expert
  • 219 Answers

Hi,
creating the object means creating the memory therefore even though there are no
members in the class also it will create a phsical memory location of 1 byte and gets the address(object is reality)

Thanks!
Sandy

Posted on May 15, 2009

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Create a class called date and a child called time in c++


Where to begin?
Easy: FIND SUITABLE LIBRARY
answer is easy, but finding is hard enough.
Hopefully c++ standart has time.h that has functions you need.
Without any talking source code below:
I created 2 files: data.h which has classes and functions and main.cpp :)

-----------------data.h-----------------
#ifndef _DATA_H_
#define _DATA_H_

#include <time.h>

class Data
{
public:
time_t rawtime; // time.h requres this
struct tm *timeinfo; // and this also
public:
Data(); // constructor
int getMonth();
int getDay();
int getYear();
char *getAll();
};


class Time : public Data // child funqcion
{
public:
int getH();
int getM();
int getS();
};

Data::Data() // copy of constructor
{
time(&rawtime);
timeinfo = localtime(&rawtime);
}

int Data::getMonth()
{

return timeinfo->tm_mon;
}

int Data::getDay()
{
return timeinfo->tm_wday;
}

int Data::getYear()
{
return timeinfo->tm_year;
}

char *Data::getAll()
{
return asctime(timeinfo);
}

int Time::getH()
{
return timeinfo->tm_hour;
}

int Time::getM()
{
return timeinfo->tm_min;
}

int Time::getS()
{
return timeinfo->tm_sec;
}

#endif
----------------------END OF FILE--------------------
I hope you know include file rule when working with multiple files. I mean you understand #ifndef and #define...

and the main.cpp:

#include "data.h"
#include <iostream>

//I hope you understand all this...

using namespace std;

Data myData;
Time myTime;
const char *months[12] =
{
"January",
"Febryary",
"March",
"April",
"May",
"June",
"Jule",
"August",
"September",
"October",
"November",
"December",
};

const char *days[7] =
{
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
};

int gmonth;
int gday;
int gyear;
int ghour;
int gmin;
int gsec;
char *compact; // why char *compact and not char compact? because Data.getAll returns *char

int main(int argc, char *argv[])
{
cout << "Getting month...\n";
gmonth = myData.getMonth();
cout << "Current month: " << months[gmonth];
cout << endl;
cout << "Getting week day...\n";
gday = myData.getDay();
cout << "Current week day: " << days[gday];
cout << endl;
cout << "Getting year...\n";
gyear = myData.getYear() + 1900; // +1900 is necessary :) because year is calculating after 1900
cout << "Current year: " << gyear;
cout << endl;
cout << "Getting hour...\n";
ghour = myTime.getH();
cout << "Current hour: " << ghour;
cout << endl;
cout << "Getting minutes...\n";
gmin = myTime.getM();
cout << "Current minutes: " << gmin;
cout << endl;
cout << "Getting seconds...\n";
gsec = myTime.getS();
cout << "Current seconds: " << gsec;
cout << endl;
cout << endl;
compact = myData.getAll(); // Coolest one :)
cout << compact << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
----------------END OF FILE--------------------
I clearly don't understand what set hours, minutes, secs mean:'
Tested and working.
If you have any questions write comment.
I compiled this project in DevCpp, but it will work for Visual Studio too.
This might be different what you expected but solve any problem AS EASY AS POSSIBLE in programming. Solve problem i mean everything is working.

Aah, I've written a lot :)
Please rate my solution...
And Successful Programming!

May 08, 2012 | HP Computers & Internet

1 Answer

Can you convert dollar to peso in c++


1) Find the dollar to peso conversion rate. You can go to Reuters to get the latest exchange rate.

2) Then Argentinian peso for example:

int main()
{
double dollar, peso;
int rate;

peso = 0;
cout << "Enter dollar amount: ";
cin >> dollar;
cout << "Enter exchange rate:";
cin >> rate;
cout.setf(ios::fixed);
cout.precision(2);
peso += dollar * rate;
cout << dollar << " dallars is equal to " << peso << " peso's." << endl;

return 0;
}

With this program you input the amount in dollars and it will give you the amount in peso's.

Sep 24, 2011 | Computers & Internet

1 Answer

How to write an electricity bill in c program(9'th class)


#include <iostream.h>
#include <conio.h>
int main()
{
clrscr();
long int units,charge=0;
float total;
const int rent=25;
cout << "Enter the number of units used : ";
cin>>units;
if(units>200)
charge=(units-200)*20+150*40+50*60;
else if(units>50)
charge=(units-50)*40+50*60;
else
charge=units*60;
total=0.01*charge+rent;
cout << "You have used " << units << " units." << endl;
cout << "Your total telephone bill is $" << total;
getch();
return 0;


Please accept the solution. Thanks, Lucy
}
This program takes in the number of units used ('units') as a screen input from the user.
It then calculates the total telephone bill for the customer on the following basis :
A compulsory fee of $25, plus
60 cents per unit for the first 50 units,
40 cents per unit for the next 150 units,
20 cents per unit for anything above 200 units.
It then outputs the bill using the 'cout' command.

Jan 12, 2011 | Microsoft Computers & Internet

1 Answer

Create program for A-D:


A.) If else statement using Javascript
<script type="text/javascript">
//If the time is less than 10, you will get a "Good morning" greeting.
//Otherwise you will get a "Good day" greeting.

var d = new Date();
var time = d.getHours();

if (time < 10)
{
document.write("Good morning!");
}
else
{
document.write("Good day!");
}
</script>

B.) Switch Case Statement Using C#
using System;

class SwitchSelect
{
public static void Main()
{
string myInput;
int myInt;

begin:

Console.Write("Please enter a number between 1 and 10: ");
myInput = Console.ReadLine();
myInt = Int32.Parse(myInput);

// switch with integer type
switch (myInt)
{
case 1:
Console.WriteLine("Your number is {0}.", myInt);
break;
case 2:
Console.WriteLine("Your number is {0}.", myInt);
break;
case 3:
Console.WriteLine("Your number is {0}.", myInt);
break;
default:
Console.WriteLine("Your number {0} is not between 1 and 3.", myInt);
break;
}

decide:

Console.Write("Type \"continue\" to go on or \"quit\" to stop: ");
myInput = Console.ReadLine();

// switch with string type
switch (myInput)
{
case "continue":
goto begin;
case "quit":
Console.WriteLine("Bye.");
break;
default:
Console.WriteLine("Your input {0} is incorrect.", myInput);
goto decide;
}
}
}


C. For Loop Statement using C++
for(i=10; i > -1; i--)
{
if(i == 0)
cout << "Blast Off!" << endl;
else
cout << i << endl;
}
}

D. While Loop Using Java
void main() {

int counter = 1;

while(counter < 5 )
{
printLine("counter is equal to " + counter);

counter = counter + 1 ;
}

printLine("Goodbye");
}


Mar 22, 2010 | Dell Vostro 220 Desktop Computer

1 Answer

I WANT THE WHOLE CODE FOR THIS


This whole code for above we can not give.

Aug 06, 2009 | Shopnovell iFolder 1.0 Software Media Kit...

2 Answers

Example of program in c++ and there code


Hello my friend, I am Jonas I work as a programmer in some various programming languages. Here try this code:
This program is design to output the Diameter, circumference, and area given a radius of a circle. #include <iostream.h> int main() { int radius, diameter, circumference, area, pi; cout << " Enter the radius of a circle\n"; cin >> radius; pi = 3.14159; diameter = 2 * radius; circumference = 2 * pi * radius; area = pi * (radius)^2; cout << "Diameter formula executing.....(2 x r)\n"; cout << "Diameter is " << diameter << endl; cout << "circumference formula executing.....(2 x pi x r)\n"; cout << "circumference is " << circumference << endl; cout << "area formula executing......(pi x [r x r])\n"; cout << "area is " << area << endl; return 0; }
Also if you need tutorial you can visit this site Learning C++ .Hope this solution will able to help your problem solved. If you need more assistance just reply to this post or send me a mail at geo_jonas@yahoo.comThank you and Godbless.

Jul 09, 2009 | Computers & Internet

2 Answers

HOW TO PROGRAM ARITHMETIC ALGORITHM( ADDITION)IN C++


above int main () you will want "using namespace std;" without quotes. Under that, "int main ()" without quotes, then a [ bracket to start the main function.
Please rate, thanks!

Mar 16, 2009 | Computers & Internet

1 Answer

I want circularlinklist program in c++


This C++ program is to perform the following operations
on a circular linked list
1)insertion
2)forward traversal
3)reverse traversal
4)search
->node structure :
a node contains
1) integer data
2) pointer to next node
-> This program works in microsoft VC++ environment
in windows xp
-> This program uses the following header files
1)iostream.h
********************************************************/
#include<iostream.h>
class cll
{
private:
int data;
cll *next;
public:
cll* insert_one(int,cll*);
cll* delete_one(int,cll*);
void ftraverse(cll*);
void rtraverse(cll*);
void search(int,cll*);
void function();
};
cll*hd;
void cll::function()
{
cout<<”******************************************\n”;
cout<<”program to implement a circular linked list \n”;
cout<<”******************************************\n”;
cll * head;
head=NULL;
cout<<”\n\nMENU :\n”;
cout<<”1)insertion\n”
<<”2forward traversal\n”
<<”3)reverse traversal\n”
<<”4)search\n”
<<”5)exit\n\n”;
cout<<”Enter your option :”;
int opt;
cin>>opt;
int d;
while(opt!=5)
{
switch(opt)
{
case 1:
cout<<”Enter data to the node :”;
cin>>d;
head=insert_one(d,head);
cout<<”inserted\n”;
break;
case 2:
cout<<”The forward traversal is :\n”;
ftraverse(head);
break;
case 3:
cout<<”The reverse traversal is :\n”;
hd=head;
rtraverse(head);
cout<<”NULL\n”;
break;
case 4:
cout<<”Enter the element to be searched :”;
int d;
cin>>d;
search(d,head);
break;
case 5:
break;
default:
cout<<”invalid option”;
break;
}
cout<<”\n\nMENU :\n”;
cout<<”1)insertion\n”
<<”2)forward traversal\n”
<<”3)reverse traversal\n”
<<”4)search\n”
<<”5)exit\n\n”;
cout<<”Enter your option :”;
cin>>opt;
}
}
cll* cll::insert_one(int d,cll* c)
{
cll*NEW;
NEW=new cll;
NEW->data=d;
NEW->next=NULL;
if(c==NULL)
{
c=NEW;
c->next=c;
}
else
{
cll*c1=c;
while(c1->next!=c)
c1=c1->next;
c1->next=NEW;
NEW->next=c;
}
return c;
}
void cll::ftraverse(cll* c)
{
if(c==NULL)
{
cout<<”\nlist empty\n”;
return;
}
else
{
cll *c1=c;
cout<<c1->data<<”->”;
c1=c1->next;
while(c1!=c)
{
cout<<c1->data<<”->”;
c1=c1->next;
}
cout<<”NULL\n”;
}
}
void cll::rtraverse(cll* c)
{
if(c->next==hd)
{
cout<<c->data<<”->”;
return;
}
else
rtraverse(c->next);
cout<<c->data<<”->”;
}
void cll::search(int d,cll* c)
{
cll*c1=c;
if(c==NULL)
{
cout<<”\nlist empty\n”;
return;
}
else
{
if(c->data == d)
{
cout<<”found\n”;
return ;
}
while(c->next !=c1)
{
if(c->data==d)
{
cout<<”found\n”;
return ;
}
c=c->next;
}
if(c->data ==d)
{
cout<<”found\n”;
return ;
}
cout<<” search unsuccess ful \n”;
}
}
void main()
{
cll list;
list.function();
}

Mar 05, 2009 | Computers & Internet

2 Answers

C++ program for insertion, deletion in linked list and 2d array pls send the details for linked list so that i can understand it the best..considering me as a beginner.


program for deletion


#include<iostream.h>
void main()
{
int a[10],i,n,x;
cout<<"\n\t\tPROGRAM TO DELETE AN NUMBER FROM AN ARRAY";
cout<<"\nEnter the size of the array:";
cin>>n;
for(i=0;i<n;i++)
{
cout<<"\nEnter the number:";
cin>>a[i];
}
cout<<"\nEnter the position to be deleted:";
cin>>x;
for(i=x;i<n;i++)
a[i]=a[i+1];
for(i=0;i<n-1;i++)
cout<<a[i]<<" ";
}

Oct 13, 2008 | Computers & Internet

1 Answer

Wht is the solution..........following program is giving compile time error


could you please send me an example of source code for my example in school?
example
#include<stdio.h> etc....

plssss!

Oct 03, 2008 | Microsoft Windows Vista Ultimate Edition

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

82 people viewed this question

Ask a Question

Usually answered in minutes!

Top Microsoft Computers & Internet Experts

micky dee

Level 3 Expert

2658 Answers

Piyal Perera
Piyal Perera

Level 3 Expert

528 Answers

Les Dickinson
Les Dickinson

Level 3 Expert

18389 Answers

Are you a Microsoft Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...