You are not reading properly those variables. First of all, you don't need iostream.h header.
You declare the variables name and carrer with the type char - which stores just character.
For instance, if I declare: char x; in x - variable I can store data like that: x = 'a'; or x = '1'. Like you see, I store in it just a character. You want to store in them an entire name, which is composed from many characters, so you have to change the data-type. One data - type can be the array - char data type which is declared like so: char name[size_name];
On the other hand, in scanf function you are reading those values but you didn't chosen the appropriate modifier (that %i). I don't really know where it comes from but if you want to read a character, you would transform it like that: %c, if you read a string, it may be %s, if you read an integer you transform it like that %d.
We will use %s because, in fact, the name and carrer variables are strings.
This is the source:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
#include <stdio.h>
#include <conio.h>
int main()
{
char name[10], carreer[10];
int progra, calculus, mesurment;
printf("\n This program shows you the average of a student beteewn three subjects:");
printf("\n Programing, Integral calculus, and Meassurement of engeeniering");
printf("\n\n\n Enter the name of the student: ");
scanf("%s",&name);
printf("\n\n Enter the career of the student: ");
scanf("%s",&carreer);
getch();
}
|