Advertisement
luishh

Struct

Nov 9th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <locale.h>
  3. using namespace std;
  4. int main (){
  5.     struct tp_aluno{
  6.         long int RA;
  7.         string nome;
  8.         float nota1,nota2;
  9.        
  10.     };
  11.    
  12.      tp_aluno alu;
  13.      cout<<"RA do aluno: ";
  14.      cin>>alu.RA;
  15.      cout<<"Nome do aluno: ";
  16.      cin.ignore();
  17.      getline(cin, alu.nome);
  18.      cout<<"Nota 1: ";
  19.      cin>>alu.nota1;
  20.      cout<<"Nota 2: ";
  21.      cin>>alu.nota2;
  22.      
  23.      system("cls");
  24.      cout<<"RA :"<<alu.RA<<endl;
  25.      cout<<"Nome :"<<alu.nome<<endl;
  26.      cout<<"Nota 1:"<<alu.nota1<<endl;
  27.      cout<<"Nota 2:"<<alu.nota2<<endl;
  28.      cout<<"Médio :"<<(alu.nota1+alu.nota2)/2<<endl;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement