Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Will you please tell me whats wrong with my codes here, i coudn\'t open it. #inc

ID: 3536535 • Letter: W

Question

Will you please tell me whats wrong with my codes here, i coudn't open it.

#include

#include

<iostream>

#include

<conio.h>

#include

<stdio.h>

#include

<string.h>

struct

emp

{

int empcode;

char empname[20];

char desig[20];

float bsal,hra,da,netsal;

void calculate();

public:emp()

{

empcode=0;

bsal=0.0;

hra=0.0;

da=0.0;

netsal=0.0;

strcpy (empname,

"No middle name");

strcpy (desig,

"No middle name");

}

void

input();

void

output();

}ob[10];

void emp::calculate()

{

netsal=bsal+hra+da;

}

void emp::input()

{

cout <<

" Enter the employee code:" ;

cin >>empcode;

cout<<

" Enter the employee name:";

gets(empname);

cout<<

" Enter designation:";

gets(desig);

cout<<

" Enter the basic salary:";

cin>>bsal;

cout<<

" Enter HRA:";

cin>>hra;

cout<<

" Enter DA:";

cin>>da;

calculate();

}

void emp::output()

{

cout<<empcode;

cout<<empname;

cout<<desig;

cout<<netsal;

}

void

main()

{

clrscr();

int i,n;

cout<<

" Enter the number of employees:";

cin>> n;

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

{

ob[i].input();

}

cout<<

" Code Name Salary ";

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

{

ob[i].output();

cout <<endl;

}

getch();

}

%u3000

//SOME CODES GOES HERE?

%u3000

Enter the employee code:100

Enter the employee name:Penguino

Enter designation:ceo

Enter the basic salary:25000

Enter HRA:1500

Enter DA:1200

Enter the employee code:101

Enter the employee name:Darth

Enter designation:manager

Enter the basic salary:15000

Enter HRA:1600

Enter DA:1000

Enter the employee code:102

Enter the employee name:Ryedell

Enter designation:wire engineer

Enter the basic salary:5000

Enter HRA:1000

Enter DA:500

%u3000

Code Name Desig Salary

100 penguino ceo 27700

101 Darth manager 17600

102 Ryedell workerbee 6500

Explanation / Answer

stdafx.h is a file, generated by Microsoft Visual Studio IDE wizards, that describes both standard system and project specific include files that are used frequently but hardly ever change. Compatible compilers (for example, Visual C++ 6.0 and newer) will pre-compile this file to reduce overall compile times.

Visual C++ will not compile anything before the #include "stdafx.h" in the source file, unless the compile option /Yu'stdafx.h' is unchecked (by default); it assumes all code in the source up to and including that line is already compiled.


stdafx.h is the file that includes all of the commonly used headers for a single project. This would include all of the Windows definitions, for example. Because this file includes so much stuff, the compiler gets a bit slow when processing it. By precompiling it, the compiler can skip much of the processing and reuse it over and over again; as long as none of the files included by it change, the precompiled result doesn't need to change either.

The name stdafx.h is just a convention. You could easily rename it to something else if you changed all your sources to include the new file instead.

To produce the actual precompiled header file, you need one source file in the project that has special compile flags to produce precompiled output. By convention this file is named stdafx.cpp, and if you inspect the settings for that source file you will see how it is different.


the code work perfectly without usinf stdafx.h header file



#include<iostream.h>

#include<conio.h>

#include<stdio.h>

#include<string.h>

struct

emp

{

int empcode;

char empname[20];

char desig[20];

float bsal,hra,da,netsal;

void calculate();

public:emp()

{

empcode=0;

bsal=0.0;

hra=0.0;

da=0.0;

netsal=0.0;

strcpy (empname,

"No middle name");

strcpy (desig,

"No middle name");

}

void

input();

void

output();

}ob[10];

void emp::calculate()

{

netsal=bsal+hra+da;

}

void emp::input()

{

cout <<

" Enter the employee code:" ;

cin >>empcode;

cout<<

" Enter the employee name:";

gets(empname);

cout<<

" Enter designation:";

gets(desig);

cout<<

" Enter the basic salary:";

cin>>bsal;

cout<<

" Enter HRA:";

cin>>hra;

cout<<

" Enter DA:";

cin>>da;

calculate();

}

void emp::output()

{

cout<<empcode;

cout<<empname;

cout<<desig;

cout<<netsal;

}

void

main()

{

clrscr();

int i,n;

cout<<

" Enter the number of employees:";

cin>> n;

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

{

ob[i].input();

}

cout<<

" Code Name Salary ";

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

{

ob[i].output();

cout <<endl;

}

getch();

}


stdafx.h is the file that includes all of the commonly used headers for a single project. This would include all of the Windows definitions, for example. Because this file includes so much stuff, the compiler gets a bit slow when processing it. By precompiling it, the compiler can skip much of the processing and reuse it over and over again; as long as none of the files included by it change, the precompiled result doesn't need to change either.

The name stdafx.h is just a convention. You could easily rename it to something else if you changed all your sources to include the new file instead.

To produce the actual precompiled header file, you need one source file in the project that has special compile flags to produce precompiled output. By convention this file is named stdafx.cpp, and if you inspect the settings for that source file you will see how it is different.


the code work perfectly without usinf stdafx.h header file



#include<iostream.h>

#include<conio.h>

#include<stdio.h>

#include<string.h>

struct

emp

{

int empcode;

char empname[20];

char desig[20];

float bsal,hra,da,netsal;

void calculate();

public:emp()

{

empcode=0;

bsal=0.0;

hra=0.0;

da=0.0;

netsal=0.0;

strcpy (empname,

"No middle name");

strcpy (desig,

"No middle name");

}

void

input();

void

output();

}ob[10];

void emp::calculate()

{

netsal=bsal+hra+da;

}

void emp::input()

{

cout <<

" Enter the employee code:" ;

cin >>empcode;

cout<<

" Enter the employee name:";

gets(empname);

cout<<

" Enter designation:";

gets(desig);

cout<<

" Enter the basic salary:";

cin>>bsal;

cout<<

" Enter HRA:";

cin>>hra;

cout<<

" Enter DA:";

cin>>da;

calculate();

}

void emp::output()

{

cout<<empcode;

cout<<empname;

cout<<desig;

cout<<netsal;

}

void

main()

{

clrscr();

int i,n;

cout<<

" Enter the number of employees:";

cin>> n;

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

{

ob[i].input();

}

cout<<

" Code Name Salary ";

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

{

ob[i].output();

cout <<endl;

}

getch();

}



Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote