1 solutions

  • 0
    @ 2025-11-5 16:11:12

    C :

    #include<stdio.h> 
    int main()
    {
        char a[1000];
     int b=0;
     int i;
     for(i=0;scanf("%c",&a[i]),a[i]!=' ';i++)
     {
      if(a[i]=='$')
       b++;
     }
        printf("%d\n",b);
     return 0;
    }
    

    C++ :

    #include<iostream>
    using namespace std;
    int main()
    {
    	int ans=0;
    	char c;
    	while (cin>>c && c!=' ')
    		if (c=='$') ans++;
    	cout<<ans<<endl;
    	return 0;
    }
    
    • 1

    1999年秋浙江省计算机等级考试二级C 编程题(2)

    Information

    ID
    17551
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By