so i just started this programming class in school today, im having alot of trouble, i dont want everyone to do the work for me, but i would love for you guys to tell me what needs to be done, i know this is alot to ask so if anyone could reply i would really appreciate it, you would help me learn alot more.

So basically he gave us 3 long assignments which i have started on them all, but none of my programs seem to work, i have the h tags in there, but i keep getting errors. To better help me out here is the assignments he assigned us. Again thank you for even reading my post.

1) Lottery
Create a .c program that acts like a lottery.
Create 6 random numbers between 1 and 49 in your c program and store them in different variables.
Ask the user for his lottery ticket (6 numbers):
Compare what the user entered to the six random numbers generated.
Print out how many right the user got and the six lottery numbers.
A sample program Execution:
Enter your lottery numbers: 1 33 23 22 45 34
You correctly guessed 2 numbers.
The lottery numbers were 1 43 42 45 27 16
Thank you for playing.

Futchy says: This program seems simple, but when i use the random number generator he gave us it doesn't seem to work, or save the numbers long enough for me to read them back. Any ideas what im not getting, this class is moving very rapidly and i dont wanna be left behind in the dark. This is my 1st programming class and its blowing my mind

2)
Create a file (using Notepad) containing the following names, social security numbers, hourly rate, and hours worked.
B.Caldwell 163-98-4182 7.32 37
D.Memcheck 189-53-2147 8.32 40
R.Potter 145-32-9826 6.54 40
W.Rosen 163-09-4263 9.80 35
Write a c program that reads the data file created above and computers and displays a payroll schedule. The output should list a Social security number, name, and gross pay for each individual.
Also print out the name of the individual who makes the most, and the name of the individual who needs a raise (makes the least amount).

Create a file (using Notepad) named employ.dat containing the following data:
Anthony A.J. 10031 7.82 12/18/62
Burrows W.K. 10067 9.14 06/9/63
Fain B.D. 10083 8.79 5/18/59
Janney P. 10095 10.57 09/28/62
Smith G.J 10105 8.50 12/20/61
Write a program to called fcopy.c to read the file above and then
write a copy into a new file called employ.bak.
Also, calculate what the average hourly rate was (the 4th column) and
print that out to the console.

Do all this in a function called make_copy() that takes no parameters and returns the average hourly rate to the calling program.

Write functions for the following:
· A function named check(), which has three arguments. The first argument should accept an integer number, the second a floating point number, and
the third argument a double precision number. Print out the arguments in the function.
· A function named find_abs() that accepts a double-precision number passed to it and displays its absolute value.
· A function named mult() that accepts two floating point numbers as arguments, multiplies these two numbers, and returns the result.
· A function named sqr_it() that computes and returns the square of the integer value passed to it.
· A function named powfun() that raises an integer number passed to it to a positive integer power and returns the result.
· A function that produces a table of numbers from 1 to 10, their squares, and their cubes. No arguments are to be passed to the function and the function returns no value.
In your main method, make sure you call and test out all the functions above.
You can hard-code the numbers, instead of asking the user for all of them,

Futchy says: I got the files to work, but when i try to read the files back to printf them i get another error ; ;.

3.)
Create a program that rolls a die 1000 times, keeps track of how many times each number comes up and prints out the results at the end. Use the rand method to get a random number between one and 6. There is no user input to this program. Print this out to the console.
The output should look like this:
Number of 1’s=174
Number of 2’s=172
Number of 3’s=138
Number of 4’s=177
Number of 5’s=165
Number of 6’s=174

Futchy Says: This is just like the 1st question, im having trouble storing the number data long enough to read it back, i keep getting the same numbers for all 6.

4) Create a function called swap that takes in two numbers, swaps them and returns the result to the calling program. Your function should return void. Print out the values before and after the function call.

Futchy says: Same really i just having trouble calling the funtion back.
5)Write a C program that includes a function calc_avg(). In the main method, ask the user to enter values and store them in an array. If the user enters -1, then he/she is done entering values.
Once the user is done entering values, pass this array to the calc_avg function and have this function return the average of all the values entered.
Print out the result returned from the function.

float calc_avg( int a[], int num );

Futchy says: My biggest trouble, arrays ; ;, can someone explain?

6)
Build a program that performs the following operations:
§ Declares three pointer variables called iPtr of type int, cPtr of type char, and fFloat of type float.
§ Declares three new variables called iNumber of int type, fNumber of float type, and cCharacter of char type.
Ask the user for an integer, float, and character and stores them in the variables (iNumber, fNumber, and cCharacter );
§ Assigns the appropriate pointer to those variables.
§ Prints the value of each non-pointer variable.
§ Prints the value of each pointer variable.
§ Prints the address of each non-pointer variable.
§ Prints the address of each pointer variable.

Futchy Says: This is where i started realizing i needed some help, my teacher doesn't seem like a nice enough guy to offer it and im shy, i have no clue how pointers work.

7)Build a program, which uses a single-dimension array to store 10 numbers inputted by a user. After inputting the numbers, the user should see the following menu
a) Print the numbers in the array in ascending order
b) Print the numbers in the array in descending order
c) Sum the values in the array
d) Print only the lowest and largest value in the array.
e) quit
Enter your selection:
Use the following function to sort your array
#define MAX 10
void sortArray( int a[] ) {
int tmp, i, j;
for (i=0; i< MAX -1; i++) {
for (j=0; j< MAX -1-i; j++) {
if (a[j+1] < a[j]) {
tmp = a[j];
a[j] = a[j+1];
a[j+1] = tmp;
}
}
}
}
Use getchar() after the scanf to strip off the newlines.
8) Create a structure called car with the following members.
make
model
year
miles

Create an instance of the car structure named myCar and assign data to each of the members, by asking the user.
Print the contents of each member to standard output using the printf function.
9) Ask the user how many cars they want to enter. Create an array of car structures to hold the data. Make sure the user can’t enter a year less than 1900 or a miles < 0 for any of the data.
Once the user is done entering data, only print out the cars that either have a year > 2000 or a miles < 20000


As you can see my assignments are pretty easy at start but gain difficulty towards the end, by reading this you probably would think i dont pay attention in class, but i took basics of programming which was visual basic and such, but when it comes to this class im totally in the dark, i really dont want to seem like i want ppl to do the work for me, because i dont, i just want help knowing what the main thing i am needing to put into this equasion, like just answer back if you want, and help me the most by saying "Arrays are this, and this is the main code for it. here's an example", i have been hitting the books hard, and have finished all other assignments besides this. Can anyone help me?

Post your code for the assignments. No point in telling us what problems you're having with them if we can't see what's wrong with the code. Don't forget to use [code] and [/code] tags.

1. Don't try to do them all at the same time, but do them one at a time. Don't start on the second problem until you have finished the first.

2. Post the code that you have already written (and use code tags as explained here) , tell us what compiler and operating system you are using. Also post the first few error messages your compiler spewed out.

In c++, create a structure that holds fields for employee name (character array max length of 50), the social security number (an integer), and the payrate (floating point).

Declare an array variable of the struct created in 5. It should hold a maximum of 100 values.

Write the code (not an entire program), to give all employees stored in the variable declared in 6 a 3% raise.

There are two parallel arrays, one called socsec that contains the social security numbers of the employees of a company, and another array payrate where the index points to the payrate of the employee with the corresponding social security number. payrate is a float array dimensioned to hold 100 items, and socsec is an integer array with 100 elements. Assuming that the corresponding values have been put into the arrays. Write a function named individualrate which has the following parameters: arrays socsec and payrate; the number of employees entered into the array as an integer parameter; and the social security number of a particular employee as an integer.

Write function individualrate. You may do this in either c++ or pseudo code. The function should search through array socsec until a match is found with the social security number passed. The function returns the floating point value corresponding to the payrate of the employee whose social security number was given.

What is the last character in a string in C?

Give the contents of the file named update after the following pseudo code is run. The contents of file original are:
A 25 <CR>C 20 <CR>E 15 <CR> <EOF>
note that <CR> is a carriage return i.e., an end of line character, and <EOF> is an end of file mark


declare Item as char
declare Number as Int
open “original” for input as GivenFile
open “update” for output as TempFile

read GivenFile, Item, Number
while not eof (Givenfile)
write TempFile, Item, Number
read GivenFile, Item, Number
end while
close GivenFile
close TempFile

In c++, create a structure that holds fields for employee name (character array max length of 50), the social security number (an integer), and the payrate (floating point).

(...) +4 posts..

Use the edit button instead of making various posts this can be considered flooding.

@Futchy
Like prevoius posters said, tell us more information, and try to solve one problem at time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.