各位大大們好, 小弟有個C++的問題想像各位大大請教,程式碼如下:
錯誤訊息是: error: expected unqualified-id before 'while' while (ipp != sizep)
可否請大大們給點意見或幫忙除錯, 非常感謝你們
#include <iostream>
using namespace std;
void func1(int *a, int size)
{
cout << "Multiplicand:" << endl;
for(int x = 0; x!= size; x++)
{
cout << a[x] << " ";
}
cout << endl;
}
void func2(int *b, int size)
{
cout << "Multiplier:" << endl;
for(int y = 0; y!= size; y++)
{
cout << b[y] << " ";
}
cout << endl;
}
void func3(int *p,int size,int sizep)
{
cout << "PP generation:" << endl;
int *ipp = p,
while (ipp != sizep)
{
for(int i = 0; i!= size; i++)
{
for(int j = 0; j!= size; j++)
{
p[ipp] = a[j] * b[i]
ipp = ipp+1;
}
}
for (int z=0; z!= sizep; z++)
{
cout << ( p[z] )<< " ";
}
}
}
int main()
{
const int size = 8;
const int sizep = 16;
int a[] = {0, 0, 0, 0, 0, 0, 0, 0};
int b[] = {1, 1, 1, 1, 1, 1, 1, 1};
int p[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
func1(a,size);
cout << endl;
func2(b, size);
cout << endl;
func3(p,size,sizep);
cout << endl;
}
This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.
留言列表