GPS数据处理(6分)

这篇博客主要介绍了C语言在处理GPS数据方面的基础知识,适用于程序设计初学者,内容源自中国大学MOOC的课程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

程序设计入门——C语言_中国大学MOOC(慕课) (icourse163.org)

#include<stdio.h>
#include<string.h>
int SL(char a);

int main(){
	char a[100];
	char e[6];
	int c,d,h;
	int i,b,cnt,flag;
	while(gets(a)&&strcmp(a,"END")!=0){
		if(strstr(a,"$GPRMC")==NULL) continue;
		cnt=0;
		
		flag=1;//检验是否已定位 
		for(i=0;i<strlen(a);i++){
			if(a[i]==','){
				cnt++;
			}
			if(cnt==2&&a[i+1]=='A'){
				flag=0;
				break;
			}
		}
		if(flag) continue;
		
		b=0;//求校验值 
		for(i=1;a[i]!='*';i++){
			b^=a[i];
		}
		c=SL(a[strlen(a)-2])*16+SL(a[strlen(a)-1]); //取出最后两位 
		
		if(c==b%65536){
			for(i=0;i<strlen(a);i++){
				if(
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值