C++ CHEAT SHEAT
#include<stdio.h> # include<math.h> int main() { int purchased, totalpay; printf(“NOTE?/N); printf(“If number of purchased is less that 10” “the price of each unit is $5/n”); printf(“and if it is 10 or more than 10 it is $2\n\n”); printf(“Enter the number purchased item:”); scanf(“%d”, & purchased); if (purchased >=10); { } totalpay= purchased*2; printf(“total: $%d”, totalpay); { } totalpay= purchased*5; printf(“total: $%”, totalpay); } Return 0; }
C++ CHEAT SHEAT
int x; // Declare x to be an integer (value undefined) int x=255; // Declare and initialize x to 255 short s; long l; // Usually 16 or 32 bit integer (int may be either) char c='a'; // Usually 8 bit character unsigned char u=255; signed char s=-1; // char might be either unsigned long x = 0xffffffffL; // short, int, long are signed float f; double d; // Single or double precision real (never unsigned) bool b=true; // true or false, may also use int (1 or 0)
Source: github.com
C++ CHEAT SHEAT
#include<stdio.h> # include<math.h> int main() { int purchased, totalpay; printf(“NOTE?/N); printf(“If number of purchased is less that 10” “the price of each unit is $5/n”); printf(“and if it is 10 or more than 10 it is $2\n\n”); printf(“Enter the number purchased item:”); scanf(“%d”, & purchased); if (purchased >=10); { } totalpay= purchased*2; printf(“total: $%d”, totalpay); { } totalpay= purchased*5; printf(“total: $%”, totalpay); } Return 0; }