C语言程序编译以后一直显示stdio.h里报错,为啥,怎么修改?求大神!

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C语言程序编译以后一直显示stdio.h里报错,为啥,怎么修改?求大神!相关的知识,希望对你有一定的参考价值。

显示的错误是: c:\program files\microsoft visual studio\vc98\include\stdio.h(36) : warning C4518: 'extern ' : storage-class or type specifier(s) unexpected here; ignored c:\program files\microsoft visual studio\vc98\include\stdio.h(36) : error C2143: syntax error : missing ';' before 'string' c:\program files\microsoft visual studio\vc98\include\stdio.h(36) : fatal error C1004: unexpected end of file found 执行 cl.exe 时出错. ex03.obj - 1 error(s), 0 warning(s)

参考技术A 检查
#include
<stdio.h>
以前的
程序,错在前。
-----------------------------------------------
c
程序,扩展名

.c,
不要用
.cpp
c++
程序,扩展名

.cpp
不要用
.c
c++
程序
若用
stdio.h
时,先要含
c++
的头:
#include<iostream>
using
namespace
std;
#include
<stdio.h>

代码里报错的部分要怎么修改呢

程序代码:

import java.util.Scanner;
public class text {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
         while(in.hasNext()){
             String s = in.next();
             char type = s.charAt(0); 

             String[] str=new String[100];
                if(type == ‘C‘){ 

                    int len = str.length; 

                    int cnt = 1; 

                    for(int i = 0;i < len;i++){ 

                        if(str[i] == str[i+1]){ 

                            cnt++; 

                        }else

                            if(cnt>1){ 

                                System.out.printf("%d",cnt); 

                            } 

                            System.out.printf("%c",str[i]); 

                            cnt = 1; 

                        } 

                    } 

                }else

                    int len = str.length; 

                    int cnt = 0; 

                    for(int i = 0;i < len;i++){

                       

                        if(str[i]<=‘9‘&&str[i]>=‘0‘){ 

                            cnt*=10; 

                            cnt+=str[i]-‘0‘; 

                        }else

                            if(cnt == 0){ 

                                System.out.printf("%c",str[i]); 

                            }else 

                            for(int j = 0;j < cnt;j++){ 

                                System.out.printf("%c",str[i]); 

                            } 

                            cnt = 0; 

                        } 

                    } 

                } 

         }
    in.close();
    }

}

以上是关于C语言程序编译以后一直显示stdio.h里报错,为啥,怎么修改?求大神!的主要内容,如果未能解决你的问题,请参考以下文章