|
|
вернуться в форумWhere is the problem??? #include <iostream> int main() { int a,b; FILE* f1; FILE* f2; f1 = fopen("input.dat", "r"); f2 = fopen("output.dat", "w"); fscanf(f1, "%d %d", &a, &b); fprintf(f2, "%d", a + b); return 0; } It gives when submitted Crash (access viaolation)... I have no idea what the problem may be... Re: Where is the problem??? you don't need to open any files use scanf and printf. see FAQ for clarification. Re: Where is the problem??? Oh, I have obviosly misunderstood the problem. Thanks for the help! Re: Where is the problem??? Послано Hernan 9 май 2008 09:20 import java.util.*; class Sumar { private int a,b; public Sumar(int a,int b) { this.a=a; this.b=b; } public int sumar() { return a + b; } public static void main (String[] args) { int a,b; Scanner in =new Scanner(System.in); a=in.nextInt(); b=in.nextInt(); Sumar res=new Sumar(a,b); System.out.print(res.sumar()); } } Oh, I have obviosly misunderstood the problem. Thanks for the help! |
|
|