0
나는 프로그램을 가져 와서 일부분을 생략했다. 아직도 의사 코드로 간주되는지 확실하지 않습니다. 여기있어.이것을 의사 코드로 변경하는 방법
#include "mbed.h"
const int BUFFERSIZE = 1024;
int buffer[BUFFERSIZE];
int UTC[10];
int lat[10];
int ns;
int lon[10];
int ew;
int posfix;
int numsats[2];
Serial pc(p9, p10);
Serial gps(p13, p14);
int findStart(int pos)
{
for(int i = pos; i < BUFFERSIZE; i++)
{
if buffer[pos to pos+5] == “$GP”
return pos + 5;
else
return BUFFERSIZE;
}
return BUFFERSIZE;
}
bool code(int pos, char c[3])
{
if(buffer[pos to pos + 2]==c)
return true;
else
return false;
return false;
}
void loadVariables(int pos)
{
assign variables based on relative position to pos
}
void displayVariables()
{
for every variable
print description + value;
}
void parsebuffer()
{
int pos = 0; // current read position in the buffer
while (pos < BUFFERSIZE - 1)
{
pos = findStart(pos);
if(pos > BUFFERSIZE - 50) return;
bool codeknown = true;
if (found “GGA”)
{
pc.printf("Found GGA\r\n");
loadVariables(pos+3);
displayVariables();
}
else if (found “GLL”)
{
pc.printf("Found GLL\r\n");
}
else
codeknown = false;
if(!codeknown)
print code found
}
}
int main() {
pc.baud(4800);
pc.format(8,Serial::None,1);
gps.baud(4800);
gps.format(8,Serial::None,1);
pc.putc(0x0c);
while(1) {
put data from GPS into array
parsebuffer();
pc.printf("\r\npress a key to continue\r\n");
pc.getc();
}
}
큰 문제. –
이것은 의사 코드에 대한 아이디어를 줄 수 있습니다 http://www.coderookie.com/2006/tutorial/the-pseudocode-programming-process/ –
의사 코드는 다음과 같은 몇 가지 다른 것을 의미 할 수 있습니다. "코드와 같이 막연하게 보이는 코드가 있습니다. 프로그램의 의도를 분명히하지만 모든 컴파일러에서 "~"로 컴파일되지 않을 수 있습니다. 프로세스의 각 원자 부분에 대한 영어 텍스트 설명이 있습니다 (예 : '가격 배열의 모든 값을 루프하여 화면에 인쇄'). 의사 코드 란 의사 코드가 의미하는 바를 설명하고 왜 의사 코드를 원하는지 명확하게하려는 것입니다. – Chris