You are executing the commands directly without typing the other notes

0

You are not typing the rest, just typing the first one is already going 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;
}
    
asked by anonymous 20.11.2018 / 01:57

1 answer

1

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

First you are using C ++ but programming in C. You should not do this even if it works. Then it's better to use streams , since you've even set include to it.

All calculations are being made before the data entered, and as the non-initialized variables can give any value. You could also only declare the variable when it is needed.

You are passing variables by value and not by reference which is correct in scanf() (although you should not even be using this function). It has a & that you must be imagining that you have to put in the formatting template, that's not where it stands. And the ideal is %d , i is for another.

My suggestion is to understand what each feature is, each character of the code before attempting to use each thing. Playing text randomly will not make learning.

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

    
20.11.2018 / 02:17