欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

7-13-6

程序员文章站 2022-06-10 22:16:33
...

7-13-6

#include <iostream>
using namespace std;
void Fill_array(double arr[],int *str)
{
	int i = 0;
	double n;
	cout << "input numbers:\n";
	while (cin>>n)
	{
		arr[i] = n;
		i++;
		cout << "input q to quit \n";
	}
	*str = i;
	cout << "str:" << *str << endl;
	return;
}
void Show_array(double arr[], int *str)
{
	cout << "Show_arra"<<endl;

	for (int i = 0; i < *str; i++)
	{
		cout << arr[i] << " ";
	}
	cout << endl;
	return;
}
void Rervers_array(double arr[], int* str)
{
	cout << "Rervers_array"<<endl;
	for (int i = *str-2; i >0;i--)
	{
		cout << arr[i] << " ";
	}
	cout << endl;
	return;
}
void main()
{
	//double array[] = { 0 };
	double array[10];
	int str = 0;
	Fill_array(array, &str);
	Show_array(array, &str);
	Rervers_array(array, &str);

	cout<<"hello.."<<endl;
	system("pause");
	return ;
}
  • double array[] = { 0 }; 会发生中断

  • void Fill_array(double arr[],int str) ;传不出来str
    7-13-6

推荐阅读