Functions with 2d Arrays
I make lots of mistakes while conding.
#include<iostream> using namespace std; struct bef{ double x;double y; }; struct aft{ double s;double t; }; aft transfer(bef xy); void show_result(aft st); int main(){ bef num_1; aft num_2; cin >> num_1.x >> num_1.y; num_2 = transfer(num_1); show_result(num_2); return 0; } aft transfer(bef xy){ //xy.x += 1; //xy.y -= 1; aft result; result.s = xy.x + 1; result.t = xy.y - 1; return result; } void show_result(aft st){ cout << st.s; cout << " "; cout << st.t; }

浙公网安备 33010602011771号