You are running the direct commands with no time to type the other notes

Asked

Viewed 39 times

-1

You’re not letting me type the rest, just typing the first one goes to the last one.

#include <iostream>
#include<stdio.h>


int main(void) {
    int n1,n2,pim,rn1,rn2,rpim,rfinal;
     rn1=n1*4;
     rn2=n2*4;
     rpim=pim*2;
     rfinal=(rn1+rn2+rpim)/10;
    printf("Entre com a Primeira Nota\n");
     scanf("&i",n1);
     printf("Entre com a Segunda Nota\n");
     scanf("&i",n2);
     printf("Entre com o Pim");
     scanf("&i",pim);
     printf("Nota Final e %i",rfinal);

    return 0;
}
  • Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site.

1 answer

2

This code has several problems and does not make much sense.

First you’re using C++ but programming in C. You shouldn’t make it even if it works. So it’s best use streams, since it even put the include his.

All calculations are being done before the input data, and as the variables not initialized form can give any value. Could also only declare the variable when it is needed.

Is passing the variables by value and not by reference which is correct in scanf() (although it shouldn’t even be using this function). It has a & you must be imagining that you have to put in the format template, that’s not where you put it. And the ideal is use of %d, the i is for another.

My suggestion is to understand what each resource is, each character of the code before trying to use each thing. Randomly playing text will not make learning.

Finally, Dev C++ is considered a very bad IDE to use.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.