Unexpected errors in base, calling program, struct,

Write your question here.

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
 1. #include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main ( int argc, char* argv[] )
{
 float a,b,c;
 
 if(argc=!4)
         printf("zła liczba parametrów wywołania programu!\n");
         system("pause");
         exit(1);
 }
 
  
  a = atof( argv[1] );//zamianiamy argumenty na floaty
  b = atof( argv[2] );
  c = atof( argv[3] );
 
  printf( "%f", a, b, c, a*b*c );
  return 0;
}
2. #include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void){
	FILE *in = NULL;
	char foo[16];
	char foo2[16];
	int i = 0;

	in = fopen("in.txt", "r");
	if (in == NULL){
		printf("err\n");
		system("pause");
	}

	fscanf(in, "%s", &foo);
	fscanf(in, "%s", &foo2);
	


	for (i = 0; i < strlen(foo); i++){
		printf("%c\n", foo[i]);
	}

	printf("\n");

	for (i = 0; i < strlen(foo2); i++){
		printf("%c\n", foo2[i]);
	}

	system("pause");
	return 0;
}
3.#include <stdio.h>
#include <stdlib.h>
#include <math.h>

typedef struct osoba{
	char imie[16];
	char nazwisko[16];
	int wiek;

}osoba;

int main(void)//
{
	osoba tab[2];
	char buf[64];

	int i;
	for (i = 0; i < 2; i++){
		printf("podaj imie: ");

		fscanf_s(stdin, " %s", tab[i].imie);
		printf("podaj nazwisko: ");
		fscanf_s(stdin, " %s", tab[i].nazwisko);
		printf("podaj wiek: ");
		scanf_s(" %d", tab[i].wiek);
		getchar();
	}

	for (i = 0; i < 2; i++){
		printf("%s %s ma %d lat.\n", tab[i].imie, tab[i].nazwisko, tab[i].wiek);
		
	}



	system("pause");
	return 0;
}
4. #include<stdio.h>
#include<stdlib.h>
 
typedef struct
{
int a;
int h;
}trojkat;
 
int main(void)
{
 
        trojkat NaszTrojkat={0};
        printf("podaj dlugosc podstawy: ");
        scanf("%d", &NaszTrojkat.a);
        printf("podaj wysokosc: ");
        scanf("%d", &NaszTrojkat.h);
        printf("pole wynosi: %f \n", (float)NaszTrojkat.h*NaszTrojkat.h*0.5);
 
 
 
 
 
system("pause");
return 0;
}
closed account (48T7M4Gy)
And the question is ??????????????????'

'1.' at the start of line 1 ia a bit of a blooper ;-)

Your brackets don't match
Last edited on
closed account (48T7M4Gy)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main ( int argc, char* argv[] )
{
 float a,b,c;
 
 if(argc=!4)
         printf("zła liczba parametrów wywołania programu!\n");
         system("pause");
         exit(1);
//  } <|------<<< misplaced
  
  a = atof( argv[1] );//zamianiamy argumenty na floaty
  b = atof( argv[2] );
  c = atof( argv[3] );
 
  printf( "%f", a, b, c, a*b*c );
  return 0;
}
Last edited on
Topic archived. No new replies allowed.