[ sbx @ 06.10.2004. 13:47 ] @
Jel postoji nacin da u Visual c++ pisem programe Turbo C-a. Da pojasnim, imam neku zbirku zadataka u kojoj su zadaci rjeseni u Turbo C-u , pokuso sam ih pisati u visual c++-u al uvijek mi izbaci neke greske.
[ filmil @ 06.10.2004. 14:24 ] @
Citat:
al uvijek mi izbaci neke greske.
Koje neke greške? Pošalji primer, pošalji tačan tekst greške.

f
[ sbx @ 06.10.2004. 15:33 ] @
npr. Progra koji ce ucitani string ispisat centrirano.

#define red 80
#include <stdio.h>
#include <conio.h>
#include <string.h>
main()
{char s;
int n, prazno,i;
clrscr();
printf("Zadaj string: ");
gets(s);
n=strlen(s);
prazno=(80-n)/2;
for(i=0;i<prazno;++i)
putch('');
printf("%s",s);
getch();
}
-------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
C:\Documents and Settings\Srdjan\My Documents\C jezik\Cpp1.cpp(9) : error C2065: 'clrscr' : undeclared identifier
C:\Documents and Settings\Srdjan\My Documents\C jezik\Cpp1.cpp(15) : error C2137: empty character constant
C:\Documents and Settings\Srdjan\My Documents\C jezik\Cpp1.cpp(18) : warning C4508: 'main' : function should return a value; 'void' return type assumed
Error executing cl.exe.

Cpp1.obj - 2 error(s), 1 warning(s)
[ idb @ 06.10.2004. 18:20 ] @
Mozda je najbolje da nadjes Turbo C.
ili da izmenis program....
clrscr(); ovo nemaju svi kompajleri (mozes koristiti system("cls");)
i main treba da ime tip (po standardu je int main(), sa ili bez argumenata)
putch(''); .... mozda bi pomoglo putch(' ');
Od mene toliko, i nek ti je sa srecom.

[ mmirilovic @ 06.10.2004. 23:14 ] @
Da dodam:
Umesto putch('') koristi putc(' ');
Umesto getch() koristi getc();
[ sbx @ 07.10.2004. 09:10 ] @
Puno hvala dečki!