DX Gaming http://www.dxgaming.com/forums/ |
|
cout/cin not identifing http://www.dxgaming.com/forums/viewtopic.php?t=20879 |
Page 1 of 1 |
Author: | chips LL [ Sat Dec 05, 2009 6:27 pm ] |
Post subject: | cout/cin not identifing |
ok like, im kinda new to programing so shit if anyone can help me PLOX do! mainly looking to jiza and bob cuz i know they both no how to do something with it! problem= on my compiler (microsoft visual C++ 2008) it says that cin and cout arent properly named or somethin as i posted what it gives me as the problem below um ok this is my code so far *this is a program to find out 5 grades then average them, then i have to list those grades or w,e, the implementation of the code is no prob, I am pretty creative when it comes to getting around shizz,, so ya, but I cant get around cout and cin,,, its like all essential and stuff but ya heres my code thus far // program in C++___ project // anthony selby //problem area std::cin std::cout using namespace std; #include <iostream> // where processing begins int main (); { int ga1; int gaII; int gaIII; int gaIIII; int gaIIIII; cout << "Enter test grade 1: "; cin >> ga1; if (ga1 < 0) { cout << "your entered a negative number, grades cannot be negative : "; } else if (gaII>0) { cout << "enter test grade 2: "; cin << "gaII"; } else cout << "you entered zero"; cout << endl << "The absolute value is " << << endl; return 0; } i[u] I get this era[/u] ---------------------------------------------------------------- 1>Compiling... 1>as 1.cpp 1>g:\as 1\as 1.cpp(4) : error C2653: 'std' : is not a class or namespace name 1>g:\as 1\as 1.cpp(5) : error C2653: 'std' : is not a class or namespace name 1>g:\as 1\as 1.cpp(8) : error C2146: syntax error : missing ';' before identifier 'cout' 1>g:\as 1\as 1.cpp(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>g:\as 1\as 1.cpp(8) : error C2143: syntax error : missing ';' before 'using' 1>g:\as 1\as 1.cpp(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>g:\as 1\as 1.cpp(8) : error C2871: 'std' : a namespace with this name does not exist 1>g:\as 1\as 1.cpp(14) : error C2447: '{' : missing function header (old-style formal list?) ----------------------------------------------------------------- note the code isnt finished, i just want to be able to build it now and get rid of the eras i know will pop up again in this compiler (using visual C++) I also didnt complete the precode or w,e u want to call it where i basically say wtf i want to do in the whole program,, but here it is below set declarations //program purpose- average 5 test grades together //set enter grades into average formula //(gradeA + gradeA + gradeA +gradeA + gradeA)/ 5 //display grade average, //the student variable = number of students being compared Set variables for list set interger variables- gradesA 1-5 //use ticks to number ga1, gaII, gaIII, gaIIII, gaIIIII second set of grades- gb1, gbII, gbIII, gbIIII, gbIIIII third set of grades- gc1, gcII, gcIII, gcIIII, gcIIIII fourth set of grades- g41, g4II, g4III, g4IIII, g4IIIII 5th set of grades g51, g5II, g5III, g5IIII, g5IIIIIl.,. ============section y================ cout-ask how many students your grading today? (max 5) cin- variable 'Student' if (student >5) cout you have entered a number greater than 5, maximum is 5 try again (endl) move to section y else if (student <0) cout this program doesn't accept negative numbers move to section y else if (student=0) cout to little grades to find class average else if (student=1) move to section 1 else if (student=2) move to section 2 else if (student=3) move to section 3 else if (student=4) move to section 4 else if(student=5) move to section 5 ===============section 1==================== int name1 cout enter your first students name cin name1 cout enter name1 's 1st test grade cin ga1 (endl) cout enter first name1 's 2nd test grade cin gaII (endl) Cout enter first name1 's 3rd test grade cin gaIII (endl) cout enter first name1 's 4th test grade cin gaIIII (endl) cout enter first name1 's 5th test grade cin gaIIIII (endl) cout ga1,gaII, gaIII, gaIIII, gaIIIII,endl cout are these grades correct? y/n cin cs1 if (cs1= y) cout name1 's average is [(ga1+gaII+gaIII+gaIIII+gaIIIII)/5] go to section z if (cs1= n) go to section 1 =====================section 2==================================== int name1 int name2 cout enter your first students name cin name1 cout enter name1 's 1st test grade cin ga1 (endl) cout enter first name1 's 2nd test grade cin gaII (endl) Cout enter first name1 's 3rd test grade cin gaIII (endl) cout enter first name1 's 4th test grade cin gaIIII (endl) cout enter first name1 's 5th test grade cin gaIIIII (endl) cout ga1,gaII, gaIII, gaIIII, gaIIIII,endl cout are these grades correct? y/n cin cs1 if (cs1= n) go to section 2 else (cs1= y) cout name1 's average is [(ga1+gaII+gaIII+gaIIII+gaIIIII)/5] cout enter name2 's 1st test grade cin ga1 (endl) cout enter first name2 's 2nd test grade cin gaII (endl) Cout enter first name2 's 3rd test grade cin gaIII (endl) cout enter first name2 's 4th test grade cin gaIIII (endl) cout enter first name2 's 5th test grade cin gaIIIII (endl) ===============section 3==================== ===============section 4==================== ===============section 5==================== ===============section z==================== cout thanks for using anthony selbys grading program cin *complete* |
Author: | Apocalypse [ Mon Dec 07, 2009 9:05 pm ] |
Post subject: | Re: cout/cin not identifing |
Nerd.. |
Author: | Wizard_of_Gore [ Tue Dec 08, 2009 9:05 am ] |
Post subject: | Re: cout/cin not identifing |
Hrm. Well yr structure is a bit weird lol, but anyway... try putting Code: using std::cout;
using std::cin;
AFTERCode: #include <iostream>
instead of before.Then, let us see a paste of your exact compiler error if you still get one. |
Author: | chips LL [ Tue Dec 08, 2009 12:03 pm ] |
Post subject: | Re: cout/cin not identifing |
ya hhehehe I did that and got this weird error, i basically got it down to 1 error on visual C++ 2k6 but on 2k8 (i have on this comp) ill probably get more,, anyway im not worried about it on 2k8,, but ya hold on, it wont compile on 2k8 for some reason, i have a head ache lol f*** it its ok ill just ask the teacher right b4 i hand it in |
Author: | chips LL [ Tue Dec 08, 2009 9:03 pm ] |
Post subject: | Re: cout/cin not identifing |
1>Compiling... 1>as 1.cpp 1>g:\as 1\as 1.cpp(16) : error C2447: '{' : missing function header (old-style formal list?) 1>Build log was saved at "file://g:\as 1\Debug\BuildLog.htm" 1>as 1 - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== nvm have an extra day, its due tomorrow (wensday) when i take my final ![]() |
Author: | Wizard_of_Gore [ Wed Dec 09, 2009 8:23 am ] |
Post subject: | Re: cout/cin not identifing |
That's just a syntax error. You'll get it. |
Author: | chips LL [ Wed Dec 09, 2009 1:16 pm ] |
Post subject: | Re: cout/cin not identifing |
but how do i fix it! lol hurry up and tell me! cuz i gotta go to college later! in like 2hours but i can check while there so post post post how to fix! lol |
Author: | Wizard_of_Gore [ Wed Dec 09, 2009 2:08 pm ] |
Post subject: | Re: cout/cin not identifing |
LOL Yr not giving me much to work with here... would be nice to actually see yr code in CODE tags so I could count the lines. All I can say is maybe look the program over and make sure you don't have any { brackets open that don't close somewhere else. That can commonly give that error. |
Author: | chips LL [ Wed Dec 09, 2009 2:19 pm ] |
Post subject: | Re: cout/cin not identifing |
nope that gives the error unexpected end-of-file actually, and not unided function header |
Author: | Wizard_of_Gore [ Wed Dec 09, 2009 4:26 pm ] |
Post subject: | Re: cout/cin not identifing |
You still haven't given me your code in CODE tags so I can match your error with the line lol Fugit, headed out to the GWAR show! GWARRRRRRRRRRR (Good luck BTW ![]() |
Author: | chips LL [ Wed Dec 09, 2009 7:47 pm ] |
Post subject: | Re: cout/cin not identifing |
lmao my fault, i figured it b4 i went, i gave values to variables outside of Main () or w,e so i declared them kinda twice in a way |
Author: | asd123 [ Thu Jan 07, 2010 11:54 pm ] |
Post subject: | Re: cout/cin not identifing |
Essentially, the burritos I make, Have all of the ingredients above, horded onto one flour tortilla. It's pretty good, but also shoots through you I'm a lame spam bot and need to be permanently banned by a Forum Administrator. (Ad link deleted, but I thought the message was hilarious) - Koldoon |
Page 1 of 1 | All times are UTC-07:00 |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |