# include <conio.h>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
[Code]....
I tired changing the conditions in the for loops, but then I end up entering information multiple times and I want that to be the user's option. Do I have to change the for loops or something else? I've tried everything to get what I want but nothing works. When I print the receipt, only the last food Item that I entered prints.
Using a for loop, construct two 100 element arrays, x and y, such that element i of x stores the value sin(2*pi*i/100)) and the corresponding element of y stores cos((2*pi*i/100)). Print the values stored in the elements of x and y as you calculate them.
I have attempted to solve it but I'm not sure why the value 0 is only being printed, maybe I haven't assigned sin(2i/100)) and cos((2i/100)) to the arrays properly?
Code: #include<stdio.h> #include<stdlib.h> #include<math.h> int main () {
We are supposed to create a menu with an option to add a car (make, model etc) to inventory. I have the structure format set up as far as adding the car, but I am stuck on how to make it a dynamic array of structures or whatnot (I'm not really sure on what I'm trying to do in the first place!) Basically, the user can choose to add a car and its info in. How do you set up the array to add whatever number of cars is needed? Will it be able to add more cars should the user come back to the program later?
This is the instruction of this portion of the project :
Menu Application Add a car to inventory Prompted to add Make, Model and Year, Color, Miles, Price Finish (adds the car to the file) Cancel takes you to the main menu
Write a program that uses a record structure to store a Student Name, Student ID, Test Scores, Average Test Score, and Grade. The program should keep a list of test scores for a group of 6 students. The program should ask for the name, ID, and four test scores for each student. Then the average test score should be calculated and stored. The course grade should be based on the following scale:
Average Test Score Course Grade ------------------ ------------ 90 - 100 A 80 - 89 B 70 - 79 C 60 - 69 D 59 or below F
A table should be displayed on the screen listing each student's name, ID, average test score, and course grade. Implement with functions.
My code runs but it isnt returning anything (readable/correct) and i have no clue why. This is what i have so far:
#include <iostream> using namespace std; const int columns = 4; struct StuRec //user defined datatype { int id[6]; char names[6][20];
[Code] .....
it compiles completely but at the end instead of showing the student name ID average score and class grade it shows.... [URL] .....
Write a program that uses a record structure to store a Student Name, Student ID, Test Scores, Average Test Score, and Grade. The program should keep a list of test scores for a group of 6 students. The program should ask for the name, ID, and four test scores for each student. Then the average test score should be calculated and stored. The course grade should be based on the following scale:
Average Test Score Course Grade ------------------ ------------ 90 - 100 A 80 - 89 B 70 - 79 C 60 - 69 D 59 or below F
A table should be displayed on the screen listing each student's name, ID, average test score, and course grade. Implement with functions.
My code runs but it isnt returning anything(readable/correct) and i have no clue why. This is what i have so far:
#include <iostream> using namespace std; const int columns = 4; struct StuRec //user defined datatype { int id[6]; char names[6][20]; int scores[6][4]; double avg[6]; char grade[6]; }; //semi-colon required
I'm working with arrays and I get them column by column and need to print them. I as there a way to print in columns?
For example: I produce an array of A, B and C from a loop and then need to print them in one column and the go to the next column ....
so in the end I shall have an output like this:
A E B F C G D h ... ...
My arrays are too long (over 50K) so I cant just store the arrays and then print them. I need to produce each column array, print them and delete it and go to the next column.
I have 3 arrays (even, odd and negative), they are all different sizes, but they maximum elements they can have is 50. How do I write them to a file in this format
EVEN ODD NEGATIVE 2 3 -2 4 5 -4 6 7 -9
Code:
size = 50; //they dont all 50, its just that array cant be bigger than 50 for (int i =0; i < size; i++) { cout <<setw(5); if (even[i] != 0) { myfile << eList[i]; myfile << endl;
I have a problem in dealing with dynamic arrays. I have initialized the objects and now i want to print them.
Code: // main char* namesList[] = {"Brad Shaw","Aimen Adams","Sal Dimitry","Cristi Anreaz","Poala James"}; int idList[]={232,444,135,52,134}; Team t1( namesList,idList,5,"waqas"); t1.Print_team(); My class Team looks something like this:
[Code] ....
The print function does not work. I have to implement the print function without taking any parameters.. How should i do that ?
I define "Comwords" as a string, but apparently it takes the members as chars, then I can't set strings in a structure equal to the chars.
I see to also be having unknown problems with the ComMAL array and loading it values into another element of the same structure.
How to correct this? I was thinking of casting char elements as strings, but could find no reference in my library book regarding how to do that (lots on casting int's a doubles...)
Code:
int _tmain(int argc, _TCHAR* argv[]) { int comm = 10; int targ = 5; int death; struct AI_WORDS
Ok, for my Sunday homework I have to find the next day of the year using structures. Now, I can get the structure to read the entered date (tested that with a simple scanf to printf entered data), but I need to get it to be able to tell that it is the end of the month and print out the next month when necessary. Here is what I got so far:
Code: //Cameron Taylor #include <stdio.h> struct Date{ int month; int day; int year;
[Code] ....
As you can see, I am trying to use an array for the max day of each month (excluding Leap Year for now).
Where I use the entered month to = 'i'. Then I use 'i' as the position in the array to see if next.day is = to the max day of that position of the array.
I am having no compiler issues with GCC using -w or -Wall, but after entering the current day the program stops working and doesn't go beyond the input.
commiedic@localhost Project18$ gcc -o -Wall Exercise4.c commiedic@localhost Project18$ gcc -o -w Exercise4.c commiedic@localhost Project18$ gcc -w Exercise4.c commiedic@localhost Project18$ make Exercise4 make: `Exercise4' is up to date.
A user is supposed to enter student name, id, and grade then sort them by name, id, or grade. I managed to get it to sort by name and id correctly, but not by grade.
How do I store pointers to a struct in an array ? I am using sprintf to concatenate some values together and then output it to an array in its 1st argument. A portion of my code is shown below.
how these structures and arrays work which is why although I added alot more code than given, I sent it into my teacher and he was puzzled with my project. So I brought it back to a payroll calculator unsorted.
Sort the payroll data, and output the data to the file in order by gross pay (lowest to highest)
concepts on pointers to structures and referencing for the following two lines.
//address of the variable "struct UIP_IP_BUF" is assigned as srcipaddr uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, //data type "uip_lladdr_t" pointer points to the address of array an "nd6_opt_llao" with size UIP_ND6_OPT_DATA_OFFSET (uip_lladdr_t *)&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET]
I am going to be using a boolean variable to mark whether or not a specific field has had data entered into it. I figure the best way to do that is to initialize all the elements of the structures to 0. However, with strings and with the nested structure, I'm not sure how to do this.