Computer content: Verify the "Double int" syntax rules
Objective: To learn how to use "hit error" to understand syntax requirements
/*
* Copyright (c) 2012, computer College, Yantai University
* All Rights Reserved.
* Author: Liu Mingliang
* Completion date: January 1, 2012
October 18
* Version: V1.0
*
* Input Description: None
* Problem description: design a program that contains errors, verify the "Double int" syntax rules, and learn the "hit error" method.
* Program output: Remainder
* Problem Analysis: \ maximum value, \ cpp1.cpp (6): Error c2296: '%': illegal, left operand has type 'double'
D: \ calculate the maximum value, \ cpp1.cpp (6): Error c2297: '%': illegal, right operand has type 'double'
Error executing cl.exe.
Cpp1.obj-2 error (s), 0 warning (s)
* Algorithm Design: # include <iostream>
Using namespace std;
Int main ()
{
Int a = 7, B = 4, c;
C = a % B;
Cout <c <endl;
Return 0;
}
Result (screenshot ):
Observe and understand my summary: Although I already know the results in advance, I am more impressed with the actual operation.