473,466 Members | 1,397 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

need help with IF statment

1 New Member
if (stud1[i].mod1.averageMark>69&&stud1[i].mod1.averageMark<101)
{
stud1[i].mod1.grade="A";
}
else if (stud1[i].mod1.averageMark>59&&stud1[i].mod1.averageMark<70)
{
stud1[i].mod1.grade="B";
}
else if (stud1[i].mod1.averageMark>49&&stud1[i].mod1.averageMark<60)
{
stud1[i].mod1.grade="C";
}
else if (stud1[i].mod1.averageMark>39&&stud1[i].mod1.averageMark<50)
{
stud1[i].mod1.grade="D";
}
else
{
stud1[i].mod1.grade="F";
}
Apr 9 '08 #1
2 977
Savage
1,764 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. if (stud1[i].mod1.averageMark>69&&stud1[i].mod1.averageMark<101)
  2.        {
  3.        stud1[i].mod1.grade="A";
  4.        }
  5.    else if (stud1[i].mod1.averageMark>59&&stud1[i].mod1.averageMark<70)
  6.        {
  7.        stud1[i].mod1.grade="B";
  8.        }
  9.    else if (stud1[i].mod1.averageMark>49&&stud1[i].mod1.averageMark<60)
  10.        {
  11.        stud1[i].mod1.grade="C";
  12.        }
  13.    else if (stud1[i].mod1.averageMark>39&&stud1[i].mod1.averageMark<50)
  14.        {
  15.        stud1[i].mod1.grade="D";
  16.        }
  17.    else
  18.        {
  19.        stud1[i].mod1.grade="F";
}
And your problem except that grade is most likely a char,and not a string is?
Apr 9 '08 #2
hsn
237 New Member
usually when someone explains something in a forum they ask a question or ask for help.
i don't think that we should gess the question

hsn
Apr 9 '08 #3

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

Similar topics

1
by: e_AK_05 | last post by:
I have a question and I can't figure out how to do it. I have a select statment : SELECT table1.* AS table1.*, table2.* AS table2.* FROM table1, table2 WHERE 1 this does not work...for me at...
6
by: rahul8143 | last post by:
hello, I am really confused over following for code snippets. No problem that they are working codes but how? how they are evaluated by compiler? It will be my pleasure if you explain me all...
1
by: Me, Myself, and I | last post by:
First off, i apologize if my terminology is off... I am currently in a project that is basically a front-end to a database. In coding this, I am taking into account that it has the *potential*...
1
by: llee | last post by:
Error message says: Syntax error (missing operator) in query expression. When I click on the debug button, it highlights the line I bolded below ( qryDef.SQL = strSQL & " " & strWhere & "" &...
0
by: invy | last post by:
Hi, I'm a newbie to SQL SERVER world. My program(writen in Pro*C) uses both SQLAIW32.DLL and SQLAKW32.DLL libraries. We have two versions. ie, V1 and V2 with 2 pairs of theses DLLs. My problem is...
1
by: naveenchhibber | last post by:
Hi all pls tell me that the following statment is valid in oracle 9i or 10g.. update ws set received_by_facility = coalesce(rbf_ouk.organizational_unit_id, 0), ...
2
by: fperri | last post by:
Hi, I have a table with over 20 columns. Seven of these of these columns correspond to a filter on a search form. Based on what is selected on the search form, and what is in these seven fields in...
2
by: ZT.Ph34rl3ss | last post by:
Hi there, First off thank you for reading. I'm trying to get the following to work. I want a script that does the following 9 times: jah(urlOne); and then 1 time: jah(urlTwo); then it should...
1
by: itnassol | last post by:
Hi guys, What i want to do is use a query that will return one of each type regardless of the other in there, for example. i have a list of unit unit 3131,3132,3133 etc and they have a status...
1
oranoos3000
by: oranoos3000 | last post by:
hi (i use php and mysql on os windows) i want to use statment in mysql like statement select top in sql server for show only 1 record with specific condition i use under statment as follow ...
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.