Shankye 36 Junior Poster

But we have both char = char and char = int lines ...

Is it not better if he uses both char and than convert to int wherever necessary ..

struct read_file {
        char first[100];
        char second[100];
} var;

fscanf(fp, "%s = %s", var.first, var.second);
myk45 commented: Agreed +1
Shankye 36 Junior Poster

Array of doubles,
4 subjects and 20 students so total number of elements will be 80..

double Marks[80];

And for scanning use another loop inside while

while(student_num < 20)
{
     for(int i=0; i<4; i++)
     {
        // Scan "students_num"th students "i"th marks ..
      }
}
Shankye 36 Junior Poster

Toooooooooo Cool .. Super cool...

Mera
Bharath
Mahan

:) :) :) :)

Shankye 36 Junior Poster

@Sean
Its C thread ..

Shankye 36 Junior Poster

Thank you :)

If problem solved mark this thread solved ..

Happy programming :)

Shankye 36 Junior Poster

Experts are toooo busy to read full thread ..

Oh i didnt knew thr is scanf function :D

He said he couldnt use it and wanted some other way ..

vedro-compota commented: you are right)))))))))) +1
Shankye 36 Junior Poster

@Trentacle
He casting to int directly dude how he will get correct int value??


@Vedro

You can do like this, (with some Portability issues ;) )

n = getchar()-'0';

Something good will come out ;) :D

Shankye 36 Junior Poster

NULL is a macro defined in <stddef.h> for the null pointer.

Its not '/0' its '\0'

'\0' is defined to be a null character, a character with all bits set to zero.Used as end of string.

Shankye 36 Junior Poster

ok thanks :)

How about going 4 5 years back in schooling time and doing how we used to do in school

p1 = 3x^2 + 2x^1 + x^0
p2 = 1x^2 + 1x^1 + 2x^0
----------------
multiplying term by term

p4 = 6x^2 + 4x^1 + 2x^0
p5 = 3x^3 + 2x^2 + 1x^1
p6 = 3x^4 + 2x^3 + 1x^2
-------------------------------------

Adding above will give our answer ..


I think this approach will be easier ..

mul(poly p1, poly p2, poly *p3)
{
poly p[p1.noOfterms];

	for(int i=0; i<p1.noOfTerms; i++)
	{
	   for(int j=0,int k=0; j<p2.noOfTerms; j++,k++)
            {
		p[i].terms[k].coeff = p1.terms[i].coeff * p2.terms[j].coeff;
	        p[i].terms[k].expo  = p1.terms[i].expo  + p2.terms[j].expo;
	    }
	}

   // Using a loop Comapare exponent and if equal add their coeff

}
vinitmittal2008 commented: Like ur suggestion :) +1
Shankye 36 Junior Poster

No idea about new books

But search for

Committee Draft — Septermber 7, 2007 ISO/IEC 9899:TC3

Shankye 36 Junior Poster

Write to fflush all the buffers and make stdin and stdout clean..

IF possible post full code, will try to compile and check whether it works here

Shankye 36 Junior Poster

First of all, when you scanning float u should use %f

scanf("%f", &num);

I think u need an int operand to to use with %..
so cast the float to int with (int)

rightdigit = (int)num % 10;
Shankye 36 Junior Poster

@Dragon I think he is opening two different files ..

One is familyin.txt and familyout.txt..
Whr you talking about those two???

Ancient Dragon commented: Yes, you are right :) +34
Shankye 36 Junior Poster

Multiples of 3 gives 27

the remainder of the operation is given by modulus operator(%)

so
.
27%4 = 3 which is remainder obtained by division ..

Shankye 36 Junior Poster

Oopss sorry new to this place ..