473,403 Members | 2,323 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,403 software developers and data experts.

There is a problem in my algorithm, where I am not being able to incorporate the clas

Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. #include<conio.h>
  3. #include<fstream.h>
  4. void enter();
  5. void result();
  6. class applicant
  7. {
  8. long ano;
  9. float agg;
  10. char name[30], grade;
  11.  
  12. public:
  13. void grademe()
  14. {
  15. if (agg >= 80.0)
  16. {
  17. grade = 'A';
  18. }
  19. else if (agg < 80.0 && agg >= 65.0)
  20. {
  21. grade = 'B';
  22. }
  23. else if (agg < 65.0 && agg >= 50.0)
  24. {
  25. grade  = 'C';
  26. }
  27. else if (agg < 50.0 && agg >= 33.0)
  28. {
  29. grade = 'D';
  30. }
  31. else if (agg < 33.0)
  32. {
  33. grade = 'E';
  34. }
  35. }
  36.  
  37. void enter()
  38. {
  39. cout<<"\nEnter the Applicant Number: "<<endl;
  40. cin>>ano;
  41. cout<<"\nEnter the Name: "<<endl;
  42. cin>>name;
  43. cout<<"\nEnter the Aggregate Marks: "<<endl;
  44. cin>>agg;
  45. grademe();
  46. }
  47.  
  48.  
  49. void result()
  50. {
  51. cout<<"\nApplicant Number: "<<ano;
  52. cout<<"\nName: "<<name;
  53. cout<<"\nAggregate Marks: "<<agg;
  54. cout<<"\nGrade: "<<grade;
  55. }
  56. };
  57.  
  58.  
  59. void main()
  60. {
  61. clrscr();
  62. applicant a;
  63. cout<<"_________________";
  64. cout<<"\nEnter the values: ";
  65. cout<<"\n``````````````````";
  66. a.enter();
  67. cout<<"\nTHE RESULT IS: ";
  68. a.result();
  69.  
  70.  
  71. applicant sub[5];
  72. fstream filin;
  73. filin.open("http://bytes.com/Applicant.txt", ios::in | ios::out);
  74. if (!filin)
  75. {
  76. cout<<"\nCannot open the file!!!";
  77. }
  78. else
  79. cout<<"\nData entered successfully.";
  80.  
  81. }
Feb 2 '14 #1
1 990
weaknessforcats
9,208 Expert Mod 8TB
I'll need more information. I ran your code and it works except for the aggregate calculation.

Exactly what is your problem? Please explain more fully.
Feb 2 '14 #2

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

Similar topics

2
by: Marcin Kielar | last post by:
hello i'm searching for algorithm able to detect and resolve conflicts during recursive event propagation. I'd like to implement small message passing framework without using message queue -...
4
by: deancoo | last post by:
I'm looking for an STL algorithm similar to 'copy', but not needing the target container to have elements available to copy into (a 'valid range'). What I need to do is something simple like, take...
10
by: bpontius | last post by:
The GES Algorithm A Surprisingly Simple Algorithm for Parallel Pattern Matching "Partially because the best algorithms presented in the literature are difficult to understand and to implement,...
0
by: Michel | last post by:
I was successfully able to compile and incorporate an HTML Help file into my Access database. However, the only way that I was able to do this was by repeating the name of the HTML Help file...
113
by: Bonj | last post by:
I was in need of an encryption algorithm to the following requirements: 1) Must be capable of encrypting strings to a byte array, and decyrpting back again to the same string 2) Must have the same...
6
by: Bernie Yaeger | last post by:
I need a little help with an algorithm. Let's say I have an array with 15 items. I want to find "Fern" where there are "Able", "Me Also", "Zimmerman", etc in no particular order. Forget about...
27
by: Marc Reinig | last post by:
I have a program written in Visual Studio 2003 Visual Basic. I would like to move it to Visual C++. Is there an automated or relatively automated way of doing that, or do I need to recreate all...
9
by: seberino | last post by:
I'm a compiler newbie and curious if Python grammar is able to be parsed by a recursive descent parser or if it requires a more powerful algorithm. Chris
4
prometheuzz
by: prometheuzz | last post by:
Hello (Java) enthusiasts, In this article I’d like to tell you a little bit about graphs and how you can search a graph using the BFS (breadth first search) algorithm. I’ll address, and...
20
by: mike3 | last post by:
Hi. (Xposted to both comp.lang.c++ and comp.programming since I've got questions related to both C++ language and general programming) I've got the following C++ code. The first routine runs in...
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: 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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
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,...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

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.