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

Picking the array

I can't seem to understand how I can get the program to put down the column instead of the row. Here is my program as of now:


case 'b':
case 'B':
if (Work_ID >=1 || Work_ID <= 4)
{

cout << "Please enter the worker ID: ";
cin >> Work_ID;
cout << "What day do you want the report end on? ";
cin >> Day;

cout << " Individual report: \n";
cout << name[Work_ID-1];
Work_ID = 0;
for(k =0; k < Day ; k++)
{

cout << work_hours[Day-1][k];
cout << " \n"<<"\n";
}
}



What it was suppose to do was display the column array after i have displayed the name array. basically like this:

Please enter your selection : B


Please enter the student ID : 1


What day do you want the report to end on? 3


Individual report:

Mary Johnson : 4 3 4

but I got this output:



Mary Johnson: 5 5

Everything is correct above it except that, I wanted to read 4 3. What should I do?

Thanks
Mar 24 '08 #1
2 1132
weaknessforcats
9,208 Expert Mod 8TB
if (Work_ID >=1 || Work_ID <= 4)
Let's see:
1) if WORK_ID is -256 then it is <=4. Your expression is TRUE.
2) if WORK_ID is 256 then it is >=1. Your expression is TRUE.
3) if WORK_ID is 3 then it is >=1. Your expression is TRUE.

etc...

Maybe you meant &&?
Mar 24 '08 #2
whodgson
542 512MB
......i think,
The first if( ) statement can`t be evaluated because WORK_ID value is unknown. cin>>WORK_ID should preceed it.
Mar 27 '08 #3

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

Similar topics

9
by: Bart Nessux | last post by:
I am using method 'a' below to pick 25 names from a pool of 225. A co-worker is using method 'b' by running it 25 times and throwing out the winning name (names are associated with numbers) after...
1
by: Dave Theese | last post by:
Hello all, I've been studying up on declarations (to write a parser for them) and came up with a complicated and contrived example. I just want to run it by the group to see if I've got it...
2
by: Erik Max Francis | last post by:
I was interesting in adding selection and hit testing to ZOE, and was looking at the PyOpenGL wrappers' handling of selection and picking. I see glSelectBuffer to specify the size of the buffer,...
1
by: Adam Clauss | last post by:
I have a few variables that I want declared as global. To accomplish this, I made the files globals.h and globals.cpp. In globals.h I have the declarations for the structs, and one variable...
5
by: kpp9c | last post by:
I have a several list of songs that i pick from, lets, say that there are 10 songs in each list and there are 2 lists. For a time i pick from my songs, but i only play a few of the songs in that...
8
by: Candace | last post by:
I am using the following code to pick off each digit of a number, from right to left. The number I am working with is 84357. So for the first iteration it should return the number 7 and for the...
3
by: prassaad | last post by:
HI! I 'm working on linux .I hv difficulty for picking particular line from a file... I like to make some manipulation on LINE such as 3 sda7 333333 66666 888888 444444 from file /PROC/DISKSTATS...
2
by: manuboy | last post by:
i am struggling to come up with a c program that is capable of picking up the Y, U and V parameters from a video stream and compare them with that of another stream to calculate the PSNR. i was...
3
by: jeddiki | last post by:
Hi, I am using this script which is nearly working correctly, but not quite! When a user selects some text from the web-page and copies it, the script is supposed to pick up the current...
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: 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: 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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.