473,387 Members | 1,619 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,387 software developers and data experts.

Stupid Q from a newbie

double grades[13] = {0,2,1.75,1.5,1.25,1,.75,.5,-.75,-1,-1.25,-1.5,-2};
double grade1 = 0;
double grade2 = 0;
double grade3 = 0;
double grade4 = 0;
double grade5 = 0;

Why can't I do this after I get user input into my grade variables?


amount = grades[grade1] + grades[grade2] + grades[grade3] + grades[grade4] + grades[grade5];

Sorry if its a stupid question.
Thanks
Apr 12 '07 #1
1 1066
Savage
1,764 Expert 1GB
double grades[13] = {0,2,1.75,1.5,1.25,1,.75,.5,-.75,-1,-1.25,-1.5,-2};
double grade1 = 0;
double grade2 = 0;
double grade3 = 0;
double grade4 = 0;
double grade5 = 0;

Why can't I do this after I get user input into my grade variables?


amount = grades[grade1] + grades[grade2] + grades[grade3] + grades[grade4] + grades[grade5];

Sorry if its a stupid question.
Thanks
And which values have you enterd?

(It's probably becasue array element index must be int number so it doesn't allow type of double which is number of type real)

Savage
Apr 12 '07 #2

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

Similar topics

11
by: Jason Kratz | last post by:
OK. I've search on google groups and around the web for this and I haven't found an answer. I'm a Python newbie and have what I assume is a basic question. os.listdir takes a pathname as an arg...
8
by: sebb | last post by:
I'm kind of newbie to programming, but I thought of something and I want some opinions on that. It's about a new instruction block to do some cycles. I thought about that because it's not very...
6
by: Materialised | last post by:
Hi, could someone have a look at the following code and the error message below, and point out where my error is, as I am having trouble figuring where I am going wrong. #include <algorithm>...
2
by: dawn | last post by:
Hi, I'm writing a Windows Form app, using c# (and believe me when I say I'm a newbie). The program needs two forms to functionate and I have to be able to write code that switches between the...
3
by: Eeediot | last post by:
I am trying to write code that will go through the existing list items in a listbox and perform a string comparision with a supplied string. That particular item will automatically selected if...
14
by: UJ | last post by:
What's the easiest way (without setting up a style sheet) to set the font for an area of text. I need to be able to specify the exact font and font size - not the 1-7 numbers IE uses. I want to be...
1
by: Newbie! | last post by:
In know i might sound stupid but i`ve looked all over and carn`t find out. I have a Tool Bar on my project vut how do i assign a button to a command, say i want ToolBar1, Button1 to Open a Form,...
0
by: engwar | last post by:
C# newbie here. I'm creating a page that will use a repeater control to display thumbnail images. I want to have a button next to each image so that the user can delete a particular image by...
1
by: thesafetylemur | last post by:
Howdy, (I'm a newbie C programmer, by the way...) How would one go about reading a whole line from file? I was told that something like: fscanf("%s\n", string); but it wasn't working for me.......
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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,...

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.