Question about Microsoft Windows Vista Ultimate Edition

1 Answer

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

#include
#include
class car()
{
float price;
int milege;
car model[30];

public:
void dis()
{
cout<<"\n the model of car is\t"< cout<<"\n the price is\t"< cout<<"\n average milege is\t"milege;
}
void accept()
{
cout<<"\n the model is\t";
cin>>model;
cout<<"\n enter the price\t";
cin>>price;
cout<<"\n enter company quoted milege\t";
cin>>milege;
}
};
int main()
{
car c[2];
c[0].accept();
c[1].accept();
c[0].dis();
c[1].dis();
return 0;
}

Posted by on

1 Answer

  • Level 1:

    An expert who has achieved level 1.

  • Contributor
  • 1 Answer

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

plssss!

Posted on Oct 04, 2008

Add Your Answer

Uploading: 0%

my-video-file.mp4

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

×

Loading...
Loading...

Related Questions:

1 Answer

Actually i want a source code for tower of hanoii problem which can be compiled and run in microsoft visual c++ 6.0....pls help


I am sending only the half code, rest you have to complete:-
#include <stdio.h>
#include<math.h>
# define MAXSIZE 40

using namespace;

//int stack[MAXSIZE];
//int top;


class TowerOfHanoi
{
public:

int stack[MAXSIZE];
int top;

TowerOfHanoi(int n)
{ int i;
top=-1;

for(i=n;i>0;i--)
push(i);

}

TowerOfHanoi(){
top=-1;
}
void push(int y)
{if(top>MAXSIZE){
printf("\n STACK FULL\n");
}

Apr 26, 2011 | Operating Systems

2 Answers

Merging two arrays and sort them


NEED A NEW KEY THE ONE ON THE BOX WONT WORK

Jul 29, 2009 | Microsoft Windows XP Professional With...

1 Answer

Javac unable to compile java error or batch file?


first of all you have to set path for your jdk
have you done that???????

if not then go to youtube.com and search for that vedio.

if yes, then i think you have not named the project properly

when you are to save your project, name it in the "name of the main class.java"


for example:

class Manju
{
   public static void main(String arg[]s)
     {
       ___________________________;
       ___________________________;
     }
}

save it as Manju.java and then compile

no matter what other classes are being related to the project.

this much i only know

if you wanna contact me or chat with me, my email id is linushwahs@gmail.com

May 16, 2009 | Microsoft Windows XP Professional

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 | Operating Systems

1 Answer

How to add two no in c without any operator (even assignment operator)?


This code doesn't include any overflow error checking mechanism. It is not much difficult to implement one however.
#include <stdio.h>
int main(){
unsigned num1,num2,result=0,i=0,temp=0;
printf("Enter the two numbers:\n");
scanf("%d",&num1);
scanf("%d",&num2);
for (i= ~0; i; i>>= 1){ //ensure that the body of the loop is executed 8*sizeof(unsigned) times where 8 is the number of bits in a byte. The number of bits in a byte can be more than 8 on some machines.
temp<<= 1;
temp|= (num1^num2^result)&1;
result= ((num1|num2)&result|num1&num2)&1;//to understand this line and the one above take a look at the full adder circuit above
//here temp is the equivalent of S1 in the full adder circuit above and result is the equivalent of C1
num1>>= 1;
num2>>= 1;
}
//the bit order in temp would be in the reverse order. the following code snippet reverses the order
for (i= ~0, result= ~i; i; i>>= 1){
result<<= 1;
result|= temp&1;
temp>>= 1;
}
printf("Sum: %d",result);
return 0;
}

Here is another elegant solution that uses recursion
#include <stdio.h>
int add(int a, int b){
if (!a) return b;
else
return add((a & b) << 1, a ^ b);
}
int main(){
printf("Enter the two numbers: \n");
int a,b;
scanf("%d",&a);
scanf("%d",&b);
printf("Sum is: %d",add(a,b));
}

Mar 05, 2009 | Microsoft Windows XP Professional

1 Answer

Input a number and then show the fibonacci sequence of the input number in a C++ program.


I'm assuming one of two things, either

A) You need help for a programming class?

or

B) You're just curious?

Either way

#include <iostream>
#include <algorithm>
using std::swap;
using std::cout;
using std::endl;
// Function f returns n'th Fibonacci number
// It uses Algorithm 2C: non-recursive loop
unsigned int f(unsigned int x) {
unsigned int x1=1;
for(unsigned int i=1,x2=1;i<=x;i++) {
x1+=x2;
swap(x1,x2);
}
return x1;
}
// Function f_print prints out n'th Fibonacci number
void f_print(int n) {
cout << n << "th Fibonacci number is " << f(n) << endl;
}
// main is the entry point in C++
int main() {
f_print(46);
}

Feb 18, 2009 | Operating Systems

2 Answers

Can I get the asswer for the below questions


A book shop maintains the inventory of books that are being sold at the shop. The list has details like author, title, price, publisher and stock position. Whenever a customer wants a book, the sales person inputs the title and author and the system searches the list and displays a suitable message if it is not available. If it is available, the system displays the book details and requests for the number of copies required. If the copies are available, the total cost of the copies requested is displayed, otherwise the message ‘copies not in stock’ is displayed.
Design a system using a class called BOOKS with suitable member functions and constructors. Use new operator in constructors to allocate required memory space.

Nov 16, 2008 | Operating Systems

2 Answers

Not getting the output on the screen


Try writing it like this ...


#include <iostream>
using namespace std;

int main ()
{
cout << "welcome to the world of c++! ";
return 0;
}

Nov 14, 2008 | Microsoft Windows Vista Home Premium with...

3 Answers

I need solve this type calulation is 0,1,1,2,3,5,8,13,21,34 etc. u send me the code of this type of calculation in c++ language


Ok! Here's a snippit from some code I wrote in beginning c++ classes. However, don't just cut and paste it. Know how it works since it's important in algorithm examination!

Just tested it, compiles and runs perfectly on GCC 4.0.1 on my mac, as well as my linux boxen. Windows may take some changes to output data.

/***********************************************
* Steven Parker
* Calculating Fib Sequence
* after two starting values, each number is the
* sum of the two preceding numbers
***********************************************/
#include <iostream>
using namespace std;

int main() {
int whentostop = 20; //How many values of sequence to calculate
int fib[whentostop]; //Hold fib numbers

for (int i=0; i < whentostop; i++) {
if (i == 0)
fib[0] = 0;
else if (i == 1)
fib[1] = 1;
else
fib[i] = fib[i-1] + fib[i-2];

cout << "Fibonacci[" << i << "]: " << fib[i] << endl;
}
return 0;
}

Nov 12, 2008 | Operating Systems

1 Answer

Need code


Try the Following Five Programs

1) Program for Prime Number Generation

#include <stdio.h>
main()
{
int n,i=1,j,c;
clrscr();
printf("Enter Number Of Terms
");
printf("Prime Numbers Are Follwing
");
scanf("%d",&n);
while(i<=n)
{
c=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
c++;
}
if(c==2)
printf("%d ",i)
i++;
}
getch();
}
--------------------------------------------------------------------------------------------------------------------------------------------------

2)Program for finding the prime numbers

#include <stdio.h>
#include <conio.h>
void main()
{
int n,m,k,i,max;
char c;
clrscr();
repeat: max=0;
k=2;
n=1;
printf("You want prime numbers upto:- ");
scanf("%d",&max);
printf("

");
for (i=1;i<=max;i++)
{
again: m=(n/k)*k;
if (m!=n)
k=k+1;
else
goto try1;
if (k < n/2)
goto again;
else
printf("%d",n);
printf(" ");
try1: n=n+1;
k=2;
}
fflush(stdin);
printf ("

Do you want to continue?(y/n):- ");
scanf("%c",&c);
if (c=='y')
goto repeat;
getch();

}
---------------------------------------------------------------------------------------------------------------------------------------------------

3)
  1. #include <stdio.h>
  2. int main(void) {
  3. int n,
  4. lcv,
  5. flag; /* flag initially is 1 and becomes 0 if we determine that n
  6. is not a prime */
  7. printf("Enter value of N > ");
  8. scanf("%d", &n);
  9. for (lcv=2, flag=1; lcv <= (n / 2); lcv++) {
  10. if ((n % lcv) == 0) {
  11. if (flag)
  12. printf("The non-trivial factors of %d are: \n", n);
  13. flag = 0;
  14. printf("\t%d\n", lcv);
  15. }
  16. }
  17. if (flag)
  18. printf("%d is prime\n", n);
  19. }
---------------------------------------------------------------------------------------------------------------------------------------------------

4)

#include<stdio.h>

#include<conio.h>

void main()

{

int n,i,c=0;

clrscr();

printf("enter the number:");

scanf("%d",&n);

for(i=1;i<=n;i++)

{

if(n%i==0)

{

c=c+1;

}

}

if(c==2)

printf("number is prime");

else

printf("number is not prime");

getch();

}
-------------------------------------------------------------------------

5)
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("enter the number:");
scanf("%d",&a);
for(b=2;b<a/2;b++)
{
if(n%i==0)
{
printf("\n Its not a Prime number");
c=1;
break;
}
if(flag==0)
printf("\n Its a Prime Number");
getch();
}
}


Sep 02, 2008 | Operating Systems

Not finding what you are looking for?
Microsoft Windows Vista Ultimate Edition Logo

Related Topics:

189 people viewed this question

Ask a Question

Usually answered in minutes!

Top Microsoft Operating Systems Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

Scott Fryer

Level 2 Expert

80 Answers

Carlos L. Burgos
Carlos L. Burgos

Level 2 Expert

508 Answers

Are you a Microsoft Operating System Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...