1 solutions

  • 0
    @ 2025-11-5 15:26:33

    C :

    #include <stdio.h>
    #include <stdlib.h>
    
    /* run this program using the console pauser or add your own getch, system("pause") or input loop */
    
    int ctof(int c)
    {
    	int f;
    	f=32+c*9/5;
    	return f;
    } 
    int main(int argc, char *argv[]) {
    	int c,f;
    	for(c=-100;c<=150;c+=5)
    	{
    		f=ctof(c);
    		printf("c=%d->f=%d\n",c,f);
    	}
    	return 0;
    }
    

    C++ :

    #include<iostream>
    using namespace std;
    int ctof(int c)
    {
    	return 32+c*9/5;
    }
    int main()
    {
    	for (int c=-100; c<=150; c+=5)
    		cout<<"c="<<c<<"->f="<<ctof(c)<<endl;
    	return 0;
    }
    
    • 1

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

    Information

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