Code: //Ripal Bhatt #include <iostream> using namespace std; int main() { float month1, inch1, month2, inch2, month3, inch3; float avg; cout << "Type the first month."; cin >> month1; cout << "Type the inches of rainfall for the first month. "; cin >> inch1; cout << "Type the second month. "; cin >> month2; cout << "Type the inches of rainfall for the second month. "; cin >> inch2; cout << "Type the third month. "; cin >> month3; cout << "Type the inches of rainfall for the third month. "; cin >> inch3; avg = (inch1 + inch2 + inch3) / 3; cout << "The average rainfall for " << month1 << ", " << month2 << ", and " << month3 << "is " << avg << "inches."; return 0; } I'm getting "[ILINK32 Error] Error: Unresolved external '__InitVCL' referenced from C:\PROGRAM FILES (X86)\EMBARCADERO\RAD STUDIO\7.0\LIB\CP32MTI.LIB|crtlvcl" error.
I'm trying to make it add 3 different numbers, 3 inches and find the average. when i run it, i get a command prompt asking, "Type the first month." And i type "April." When i press Enter i see all the things things in the quotations in my code up there. shouldnt it ask my to type the inches?
you type April? if you want to enter strings do not use float variables changes Code: char month1[15],month2[15],month3[15]; float inch1,inch2,inch3;
Normally this error will come when we are combining more than one files. So it is your library file problem. when it is try to include in your program it gets this error.
ty so much virxen, can you explain to me how you figured that out? what do you mean strings? is strings only letters? and float,double, long double, is for numbers? im new at this, thank you again.
Type Bytes Bits Range short int 2 16 -16,384 -> +16,383 (16kb) unsigned short int 2 16 0 -> +32,767 (32Kb) unsigned int 4 16 0 -> +4,294,967,295 ( 4Gb) int 4 32 -2,147,483,648 -> +2,147,483,647 ( 2Gb) long int 4 32 -2,147,483,648 -> +2,147,483,647 ( 2Gb) signed char 1 8 -128 -> +127 unsigned char 1 8 0 -> +255 float 4 32 double 8 64 long double 12 96 float is number but can take demical part double the same as float but with more digits. strings ============ can contain letters,numbers,characters. "123" is a valid string(always inside quotes) but it is not a number. For example You can not add it to a number as it is. "123" is different from 123
Whats a character? Like #$^&^*? if i type cout << "123"; and if i type cout << 123; does that make any sense? how is it difference? you said "123" is a string and not a number... how do i add it if i ask someone to keyboard back to me a number. and if they type back 123, is that a number or a string?
the only difference is in mathematics when you print "123" you get 123 on the screen if you print 123 you still get 123 on the screen. but when you say: "123"*123 it's wrong but 123*123 is correct. when you want to check if two number are equal you say if (a==123){} but for strings if (strcmp(a,"123")==0){} when a user enter data from the keyborad if he enters 123 is it string or number? it depends on the data type of the variable you are asking. for example int a=0; cin>>a; //enter 123 --->it's a number but char a[30]; cin>>a //enter 123 --->it's a string --->"123\0" character \0 is used to informs as that a string ends here