int main() {
	int assignment1[30]; " ";
	int assignment2[30]; " ";
	int assignment3[30]; " ";
	int assignment4[30]; " ";
	int assignment5[30]; " ";
	int assignment6[30]; " ";
	char totalPoints = "assignment1; + assignment2; + assignment3; + assignment4; + assignment;5 + assignment6;";
	
	printf(" Grade calculator ... By Geoffrey \n\n");
	printf(" Please enter your grades \(in points\) after \n each prompt and press the enter key.\n\n");
	printf("Assignment 1:");
	scanf ("%s", assignment1);
	printf("Assignment 2:"); 
	scanf ("%s", assignment2);
	printf("Assignment 3:");
	scanf ("%s", assignment3);
	printf("Assignment 4:");
	scanf ("%s", assignment4);
	printf("Exam:");
	scanf ("%s", assignment5);
	printf("participation");
	scanf ("%s", assignment6);
	int totalScore; + x = 900;
		return 0;

}

ok i wanted to add the assignment1-6, and then do a basic algebra problem as the following..

totalScore - 900 = x(what ever the user has typed in , in this case its 50 )

someone help id appreciate this

Edited 7 Years Ago by geoffy0404: n/a

I really don't see the purpose of the quotes int assignment1[30]; " "; Won't this achieve the same thing int assignment1[30]; Plus this line char totalPoints = "assignment1; + assignment2; + assignment3; + assignment4; + assignment;5 + assignment6;"; should be char totalPoints[] = "assignment1; + assignment2; + assignment3; + assignment4; + assignment;5 + assignment6;"; This above are only suggestions because I'm not really sure what your trying to accomplish here

I really don't see the purpose of the quotes int assignment1[30]; " "; Won't this achieve the same thing int assignment1[30]; Plus this line char totalPoints = "assignment1; + assignment2; + assignment3; + assignment4; + assignment;5 + assignment6;"; should be char totalPoints[] = "assignment1; + assignment2; + assignment3; + assignment4; + assignment;5 + assignment6;"; This above are only suggestions because I'm not really sure what your trying to accomplish here

i need to know how to make a mathmatical equation with all of those variables

int main() {
	int assignment1[30]; " ";
	int assignment2[30]; " ";
	int assignment3[30]; " ";
	int assignment4[30]; " ";
	int assignment5[30]; " ";
	int assignment6[30]; " ";
	int totalPoints[] = "assignment1+assignment2+assignment3+assignment4+assignment5+assignment6";

	printf(" Grade calculator ... By Geoffrey Prata \n\n");
	printf(" Please enter your grades \(in points\) after \n each prompt and press the enter key.\n\n");
	printf("Assignment 1:");
	scanf ("%s", assignment1);
	printf("Assignment 2:"); 
	scanf ("%s", assignment2);
	printf("Assignment 3:");
	scanf ("%s", assignment3);
	printf("Assignment 4:");
	scanf ("%s", assignment4);
	printf("Exam:");
	scanf ("%s", assignment5);
	printf("participation:");
	scanf ("%s", assignment6);
	printf(" your total points are:" totalPoints);
		return 0;

}

here is an update version, i am still having problem i just need to find out how to make a mathmatical equation using assignment1-6..

i think u should read the C syntaxes for arithmetic operation first.
Thats not a way to do arithmatic operations in C.
U will find them in any book on C.

int main() {
	int assignment1[30]; " ";
	int assignment2[30]; " ";
	int assignment3[30]; " ";
	int assignment4[30]; " ";
	int assignment5[30]; " ";
	int assignment6[30]; " ";
	int totalPoints[] = "assignment1+assignment2+assignment3+assignment4+assignment5+assignment6";

	printf(" Grade calculator ... By Geoffrey Prata \n\n");
	printf(" Please enter your grades \(in points\) after \n each prompt and press the enter key.\n\n");
	printf("Assignment 1:");
	scanf ("%s", assignment1);
	printf("Assignment 2:"); 
	scanf ("%s", assignment2);
	printf("Assignment 3:");
	scanf ("%s", assignment3);
	printf("Assignment 4:");
	scanf ("%s", assignment4);
	printf("Exam:");
	scanf ("%s", assignment5);
	printf("participation:");
	scanf ("%s", assignment6);
	printf(" your total points are:" totalPoints);
		return 0;

}

here is an update version, i am still having problem i just need to find out how to make a mathmatical equation using assignment1-6..

Trust me mate, you have more than one problem. The quality of the code you have posted demonstrates a severe lack of understanding in the core basics of C.

For one you declare six arrays of 30 integers and in the context of your program I still don't understand why you have done this.

Those funky null assignments after each array declaration .. well you've got me heading to the refrigerator for another beer.

Your declaration and subsequent assignment of the totalPoints array is turning me into an alcoholic. And your use of format specifiers in your scanf leaves me hankering for another beer.

All jokes aside - I really don't understand what you're trying to achieve with your program. I have posted a simple code snippet of a program that asks for six grades and then prints out the average. Here's the code:

#include <stdio.h>

int main(void) {

    int assignment[6];
    int i;

    int totalScore = 0;

    printf("Grade calculator ... By Geoffrey \n\n");
    printf("Please enter your grades (in points) after each prompt and press the enter key.\n\n");

    for (i = 0; i < 6; i++) {
        printf("Assignment %d: ", i + 1);
        scanf("%d", &assignment[i]);
        totalScore += assignment[i];
    }

    printf("The average score is %f ", (float)totalScore/i);
    return 0;
}

I know that's not what you're looking for, but I'm hoping that a little bit of study of this code on your part may help you out with your actual problem.

Edited 7 Years Ago by yellowSnow: n/a

Main problem is formatting. Something like this oughta work.

int i,totalPoints=0;
int assignment[6];
for(i=0;i<6;i++)
{
	printf("\nAssignment%d: ",i+1);	
	scanf ("%d",&assignment[i]);
}
for(i=0;i<6;i++)
	totalPoints+=assignment[i];
printf("\ntotalPoints = %d\n",totalPoints);

Main problem is formatting. Something like this oughta work.

int i,totalPoints=0;
int assignment[6];
for(i=0;i<6;i++)
{
	printf("\nAssignment%d: ",i+1);	
	scanf ("%d",&assignment[i]);
}
for(i=0;i<6;i++)
	totalPoints+=assignment[i];
printf("\ntotalPoints = %d\n",totalPoints);

Did you read my post nimrod?
[edit] Sorry, I didn't read your response .. my apologies[/edit]

Edited 7 Years Ago by yellowSnow: n/a

Did you read my post nimrod?
[edit] Sorry, I didn't read your response .. my apologies[/edit]

Heheh, no worries. You posted while I was writing mine.

Comments
Again, sorry for the remark .. a matter of timing ;-)
This article has been dead for over six months. Start a new discussion instead.