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

Help with my lab! data from file into arrays.

5
TTTFF
9234 FFFTT
2345 TTTTT
4567 FFFFF

//Philip Nguyen
//fatguyinalilcoat@gmail.com
//Lab 1 Mini Scantron

#include <stdio.h>
#include <stdlib.h>
#define MAXSTUDENTS 50
#define MAXQUESTIONS 100

int getKey(FILE*,char [], int numberTests);

int main(void)
{

FILE*fpIn;
char key[MAXQUESTIONS];
int studentID[MAXSTUDENTS];
char studentAns[MAXQUESTIONS];
int numberTests;
int count;


fpIn = fopen("dataminiscantron.txt","r");
if( fpIn == NULL)
{
printf("No such file");
exit(100);
}
fscanf(fpIn," %d",&numberTests);
count = getKey(fpIn, key, numberTests);

printf("\n\n");
system("PAUSE");
return 0;
}//main

int getKey(FILE*fpIn,char key[], int numberTests)
{
int i;

while(fscanf(fpIn," %c",&key[i])!=EOF)
{
i++;
}//while
printf("KEY: ");
for(i = -1; i < numberTests-1; i++)
{
printf("%c", key[i]);
}//for
printf("\n");
return i;
}//getData




the first line is how many questions there are
the second line is the correct answer key
the third line on is the students unique pin number and their answer
my question is this, how do i input the third line of the data into an array?
Jan 17 '07 #1
0 975

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

Similar topics

6
by: Agency | last post by:
I'm trying to program a utility that counts the beats per minute in a song by tapping the spacebar. I already have a program that does this, but I wanted to make my own. The "enter" key resets the...
5
by: ahin | last post by:
my probgram doesn't show the total mark and the grade1 can any one solve the problem? this is easy thing but i vahe only 15 min to solve it #include<iostream> #include<string> using...
11
by: Jim Madsen | last post by:
Hi all-- Two years ago I bought a copy of vbdotnet2003 and the book "Learn MS VBDotNet 2003 in 21 Days", published by Sams. I started working through the book, but lost interest. This...
20
by: ML | last post by:
Integers are stored in tables using only 4 bytes. Is there a way in SQL to retrieve the value as it is actually stored, not converted back into the displayed number? For example, if I have...
16
by: Sam Durai | last post by:
Hello, I need to merge a small table (of rows less than 100,sometimes even 0 rows) to a big table (of rows around 4 billion). I used the PK of the big table as merge key but merge does a table scan...
7
by: sri | last post by:
My environment is DB2v9.1, Windows/AIX and I am trying to compile the stored proc below and I am getting an error, "ERROR SQL0104N An unexpected token "WITH" was found following "User_ID =...
5
by: yogi_bear_79 | last post by:
Distant learning student. My lab is to write a function to perform the addition of large integers, with no limit to the number of digits. (Also have to do a subtraction, division, and...
5
by: =?Utf-8?B?R3VpbmVhcGln?= | last post by:
Hi, I just wrote a mini C# lab for myself, I think it may be useful for others, so I shared it on my blog. If you often need to write only serveral lines of code and don't want to waste time on...
2
by: kheitmann | last post by:
OK, so I have a blog. I downloaded the "theme" from somewhere and have edited a few areas to suit my needs. There are different font themes within the page theme. Long story short, my "Text Posts"...
4
by: DHS1 | last post by:
Hey guys. I have a lab that is due in two weeks, but I wanted to start on it now. Problem is, I'm at home during christmas break so I can't ask my professors. Here's my problem: I am given a very...
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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.