有人可以帮我填写评论,我是新的指针 [英] Can someone please help me with filling in the comments, im new at pointers

查看:84
本文介绍了有人可以帮我填写评论,我是新的指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

double ** m;



int rows = 10,cols = 10;



/ *在这里添加代码为m * /
分配内存


/ *写一个循环,为每个行指针分配一个cols双精度数组* /



for(i = 0,j = 0; i< rows * cols; i ++,j + = 1299827){



m [i / cols] [i%cols] =(j%1024) - 512;



}



/ *写代码来调用打印出矩阵并在此调用的函数* /



/ *删除所有列数组* /



/ *删除行数组* /



我尝试过:



我曾尝试在谷歌上查找但我对c ++不太熟悉...请帮助!!

double **m;

int rows = 10, cols = 10;

/* add code here to allocate memory for m */

/* write a loop which allocates a "cols" array of doubles for each "rows" pointers */

for (i = 0, j = 0; i < rows*cols; i++, j += 1299827) {

m[i / cols][i % cols] = (j % 1024) - 512;

}

/* write code to call a function which prints out matrix and call it here */

/* delete all the column arrays */

/* delete the rows array */

What I have tried:

Ive tried looking up on google but im not familiar with c++ too much...please help!!

推荐答案

引用:

有人可以帮我填写评论,我是指针

Can someone please help me with filling in the comments, im new at pointers



那种帮助你想要的只是我们做你的HomeWork,而我们没有。



我们不做你的HomeWork。

HomeWork不是设法测试你的技能,乞求其他人做你的工作,它会让你思考,并帮助你的老师检查你对你所采取的课程的理解,以及你应用它们时遇到的问题。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

你的任何失败都会帮助你了解什么有效,什么无效,被称为'试错'学习。

所以,试一试,重读课程并开始工作。如果您遇到特定问题,请展示您的代码并解释这个问题,我们可能会提供帮助。


The kind of help you want is simply us doing your HomeWork, and this we don't.

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.


这篇关于有人可以帮我填写评论,我是新的指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆