Please help on my homework

My question is: name global variables type of t100?

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include <fstream>
using namespace std;
struct t100{
  float sesta;
  int cetvrta;
  char treca[37];
  char peta[37];
  t100 *sljedeci;
};//struct

void F_100(t100 *lista){
  t100 *novi,*zadnji;
  zadnji = lista;
  while (zadnji->sljedeci)
    zadnji = zadnji->sljedeci;
  novi = new t100;
  zadnji -> sljedeci = novi;
  novi -> sljedeci = NULL;
  cout << "sesta: "; cin >> novi -> sesta;
  cout << "cetvrta: "; cin >> novi -> cetvrta;
  cout << "treca: "; cin >> novi -> treca;
  cout << "peta: "; cin >> novi -> peta;
};
float F_37(t100 *lista){
  float suma=0;
  t100 *tekuci = lista -> sljedeci;
  while (tekuci){
        cout << "sesta: " << tekuci -> sesta << endl;
        cout << "cetvrta: " << tekuci -> cetvrta << endl;
        cout << "treca: " << tekuci -> treca << endl;
        cout << "peta: " << tekuci -> peta << endl;
    cout << "---------------------" << endl;
    tekuci = tekuci -> sljedeci;
    suma += 37 % 10;
  };
	return suma;
};
int main(){
  zadatak();
  char dalje;
  t100 *lista = new t100;
  lista -> sljedeci = NULL;
  do{
    F_100(lista);
    cout << "Dalje (d/n)? ";
    cin >> dalje;
  } while (dalje=='d');
  cout << "--------" << endl;
  F_37(lista);
  cout << "----------------------------------------------" << endl;

}
Last edited on
I don't know how to explain it better. I need to name from previous code global variables type of struct.
You create a variable of type t100 just like any other variable. For example:
t100 myVar;
Yes, pretty simple, but where are global variables with type t100 in code? Is it in struct (for ex. float sesta) or something else?
Or is it t100 *sljedeci; ?
Last edited on
I think I still don't understand your question.
where are global variables with type t100 in code?
There are NO global variables with type t100 in your code.
Topic archived. No new replies allowed.