what is wrong with this code

I recently got a question from my professor that requires me to figure out what is wrong with a certain code.
im just double checking if i got it right
1
2
3
4
5
6
7
8
9
10
11
12
 //problem code:
int F1 {int x1; int x2}
(
return x1/x2:
}

//my solution 

int F1 ( int x1, int x2)
{
return x1/x2;
}


my professor is very bad but its too late to drop the class. He didn't give me other info other than to figure out what was wrong with the original problem.
if you guys can please help me out that would be great thank you
Last edited on
Your solution seems fine. If you're ever in doubt you can just try compiling it, and if you don't have a compiler on hand you can use an online compiler like IDEone:
http://ideone.com/
ur code seems fine to me. its supposed to divide x1 to x2 right? (x1/x2)

try this. if 8/4 == 2 den bingo!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
using namespace std;

int F1 ( int x1, int x2)
{
return x1/x2;
}

main(){
int x1, x2;
cout<<"x1: ";
cin>>x1;
cout<<endl<<"x2: ";
cin>>x2;

cout<<endl<<F1(x1, x2);
}


@L B : question, how do u use ideone? i wanna try it but i dont know how to start. thnk u.

i wanna try it but i dont know how to start. thnk u.

ye smply ntr txt int da txtrea u si chos lang & clk "run".
ur wlcm!!!


if i got it right

There are a number of syntax errors which will not allow the code to compile at all, so yes, you need to correct this somehow.
Last edited on
Topic archived. No new replies allowed.