473,382 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Success while compiling

80
This is a simple step of success c++ program


Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. #include<conio.h>
  3. #include<string.h>
  4. class employee
  5. {
  6. char name[10][20];
  7. float sal[10];
  8. public:
  9.     void accept();
  10.     void display_max();
  11.     void display_min();
  12.     void display_avg();
  13.     void count();
  14. };
  15. int i;
  16. void employee::accept()
  17. {
  18. cout<<"\nEnter details of 10 employees : ";
  19. for(i=0;i<3;i++)
  20. {
  21. cin>>name[i];
  22. cin>>sal[i];
  23. }
  24. }
  25. void employee::display_max()
  26. {
  27.     int max1;
  28.     char max2[20];
  29.     max1=sal[0];
  30.     strcpy(max2,name[0]);
  31.     for(i=1;i<3;i++)
  32.     {
  33.         if(sal[i]>max1)
  34.         {
  35.         max1=sal[i];
  36.         strcpy(max2,name[i]);
  37.         }
  38.     }
  39.     cout<<"\n\nmax slary=rs " <<max1<<"   ";cout<<max2;
  40. }
  41. void employee::display_min()
  42. {
  43. int temp1;
  44. char temp2[20];
  45. for(i=0;i< 3;i++)
  46. {
  47. for(int j=i;j<3;j++)
  48. {
  49. if(sal[i]>sal[j])
  50. {
  51. temp1=sal[i];
  52. sal[i]=sal[j];
  53. sal[j]=temp1;
  54. strcpy(temp2,name[i]);
  55. strcpy(name[i],name[j]);
  56. strcpy(name[j],temp2);
  57. }
  58. }
  59. }
  60. cout<<"\n\n min sal: rs."<<sal[0]<<" ";cout<<name[0];
  61. cout<<"\n\nascending order :\n";
  62. for(i=0;i<3;i++)
  63. {
  64. cout<<" name:"<<name[i]<<" salary=rs."<<sal[i]<<endl;
  65. }
  66. cout<<"\n\ndescnding order :\n";
  67. for(i=2;i>=0;i--)
  68. {
  69. cout<<" name:"<<name[i]<<" salary=rs."<<sal[i]<<endl;
  70. }
  71.  
  72. }
  73. void employee::display_avg()
  74. {
  75. float s=0;
  76. for(i=0;i<3;i++)
  77. s+=sal[i];
  78. cout<<"\n\n average is rs."<<s/3;
  79. }
  80. void employee::count()
  81. {
  82. int count1=0;
  83. for(i=0;i<3;i++)
  84. {
  85. if(sal[i]>1000)
  86. count1++;
  87. }
  88. cout<<"\n\n  >1000 ="<<count1;
  89. cout<<"\n\n  <=1000 ="<<3-count1;
  90. }
  91. void main()
  92. {
  93. clrscr();
  94. employee e;
  95. e.accept();
  96. e.display_max();
  97. e.display_min();
  98. e.display_avg();
  99. e.count();
  100. getch();
  101. }
Feb 3 '07 #1
3 1365
reon
80
anybody can check this out....
Feb 3 '07 #2
Ganon11
3,652 Expert 2GB
If it is successful, what is your problem? What question are you asking? What do you need help with?
Feb 3 '07 #3
reon
80
ya i tried a lot and atlast find it... so if it might be helpful to others... so i just shared it....
Feb 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: A. B., Khalid | last post by:
Hello all. After a search on Google it would seem that the users of Mingw have not had good results in compiling the python sources natively. See at least: ...
1
by: Matej Kenda | last post by:
Hi all, This message is to let you know that I have successfully compiled the latest sources from the 2.3 branch on the abovementioned OS using the HP ansiC compiler version 5.50. Final...
0
by: Martin Bless | last post by:
I need to access a MSSQL database (MS-Sql, not MySQL!)and would very much like to use mssql-0.09.tar.gz which is available from http://www.object-craft.com.au/projects/mssql/download.html ...
4
by: Bilgehan.Balban | last post by:
Hi, Generally in my C code, I use the following convention to return success or failure: a) For functions that return a pointer, (allocation, filling-in a structure etc.) return Null for all...
4
by: Aaron Queenan | last post by:
When I build a C++ library to .NET using the managed C++ compiler, I get the following error message: Linking... LINK : error LNK2020: unresolved token (0A000005) _CrtDbgReport LINK : error...
2
by: Rudy Ray Moore | last post by:
Hi guys, I just upgraded to "Visual Studio .net 2003 7.1 c++" from VS6. Some things I like (proper for loop variable scoping, for example), but some other things are troubling me. One...
2
by: Ramsey | last post by:
Recently I was having a problem where the creation of an fstream object in my lib file would crash. The lib file was linked to a managed dll. I fixed the problem by changing the 'Run time...
10
by: Christina N | last post by:
When compiling my ASP.Net application, VS puts the new DLL under the local cached directory 'VSWebCache' in stead of on the server. How can I make it save the DLL file on the server when compiling?...
6
by: A.M-SG | last post by:
Hi, We are developing a SmartClient application and we are planning to expose business objects layer to SmartClient application by using ASP.NET SOAP web services.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.