Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. HELP!!I code due tomorrow

HELP!!I code due tomorrow

Scheduled Pinned Locked Moved Managed C++/CLI
helpc++
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    benibo
    wrote on last edited by
    #1

    Alright i have to write this code that is supposed to calculate the gardes of 10 students and output the highest average abd the student Identification number of the person with the highest average.I am stuck and so is my whole class so please help this is what i ahve so far.Please someone save my life // This is the main project file for VC++ application project // generated using an Application Wizard. #include "stdafx.h" #using #include using namespace System; char grade(int id, int t1, int t2);//function prototype // This is the entry point for this application int _tmain(void) { //declaration char grade; int t1,t2,tot,avg,max,high_avg_id,id,i; max=0; //Processing phase for (i=1;i<=10;i++) { Console::WriteLine(S"Please enter your Student Id: "); id = Int32::Parse(Console::Readline()); Console::WriteLine(S"Please enter Test one score: "); t1 = Int32::Parse(Console::ReadLine()); Console::WriteLine(S"Please enter Test two score: "); t2 = Int32::Parse(Console::ReadLine()); tot = t1 + t2; avg = tot/2; if (max < avg) { max = avg; high_avg_id = id; } if (avg >= 90) grade = 'A'; else if (avg >= 80) grade = 'B'; else if (avg >= 70) grade = 'C'; else if (avg >= 60) grade = 'D'; else grade = 'F'; } return 0 } char grade

    B 1 Reply Last reply
    0
    • B benibo

      Alright i have to write this code that is supposed to calculate the gardes of 10 students and output the highest average abd the student Identification number of the person with the highest average.I am stuck and so is my whole class so please help this is what i ahve so far.Please someone save my life // This is the main project file for VC++ application project // generated using an Application Wizard. #include "stdafx.h" #using #include using namespace System; char grade(int id, int t1, int t2);//function prototype // This is the entry point for this application int _tmain(void) { //declaration char grade; int t1,t2,tot,avg,max,high_avg_id,id,i; max=0; //Processing phase for (i=1;i<=10;i++) { Console::WriteLine(S"Please enter your Student Id: "); id = Int32::Parse(Console::Readline()); Console::WriteLine(S"Please enter Test one score: "); t1 = Int32::Parse(Console::ReadLine()); Console::WriteLine(S"Please enter Test two score: "); t2 = Int32::Parse(Console::ReadLine()); tot = t1 + t2; avg = tot/2; if (max < avg) { max = avg; high_avg_id = id; } if (avg >= 90) grade = 'A'; else if (avg >= 80) grade = 'B'; else if (avg >= 70) grade = 'C'; else if (avg >= 60) grade = 'D'; else grade = 'F'; } return 0 } char grade

      B Offline
      B Offline
      BAIJUMAX
      wrote on last edited by
      #2

      // Written By Baiju Max //EMail:- Baijumax@gmail.com,baijumax@yahoo.com hi man, enjoy coding .see below solution for u r problem. #include "stdafx.h" #using #include using namespace System; int _tmain(void) { int nMark1(0),nMark2(0),nStudentID(0),nCurrentStudentID(0); float flAvg(0),flMaxAvg(0); String* strGrade = new String("No Grade"); //Read The Input From The User for ( int iIndex = 0 ; iIndex < 2 ; iIndex ++ ) { Console::Write(S"Pl's Enter The Student ID:"); nCurrentStudentID = Int32::Parse(Console::ReadLine()); Console::Write(S"Enter The Test One Score:") ; nMark1 = Int32::Parse(Console::ReadLine()); Console::Write(S"Enter The Test One Score:") ; nMark2 = Int32::Parse(Console::ReadLine()); //Now Caculate Avg flAvg = (float) (nMark1 + nMark2 )/ 2 ; if( flMaxAvg < flAvg ) { flMaxAvg = flAvg; nStudentID = nCurrentStudentID; // Now Calculate The Grade if ( flMaxAvg >= 50 && flMaxAvg < 60 ) //D- Grade 50-59 { strGrade = "D" ;} else if ( flMaxAvg >= 60 && flMaxAvg < 70 ) // C- Grade 60-69 { strGrade = "C" ;} else if ( flMaxAvg >= 70 && flMaxAvg < 80 ) // B- Grade 70-79 { strGrade = "B" ;} else if ( flMaxAvg >= 80 && flMaxAvg < 90 ) // A- Grade 80-89 { strGrade = "A" ;} else if ( flMaxAvg >= 90 && flMaxAvg <= 100 ) // S- Grade 90-100 { strGrade = "A" ;} else { strGrade = "F" ; } } } Console::Write(S"Student ID Is:" ); Console::Write(nStudentID.ToString()); Console::Write(S"Highest Avg is:"); Console::Write( flMaxAvg.ToString()); Console::Write(S" Grade:"); Console::Write(strGrade); Console::ReadLine(); return 0; } by baijumax:-D

      B C 2 Replies Last reply
      0
      • B BAIJUMAX

        // Written By Baiju Max //EMail:- Baijumax@gmail.com,baijumax@yahoo.com hi man, enjoy coding .see below solution for u r problem. #include "stdafx.h" #using #include using namespace System; int _tmain(void) { int nMark1(0),nMark2(0),nStudentID(0),nCurrentStudentID(0); float flAvg(0),flMaxAvg(0); String* strGrade = new String("No Grade"); //Read The Input From The User for ( int iIndex = 0 ; iIndex < 2 ; iIndex ++ ) { Console::Write(S"Pl's Enter The Student ID:"); nCurrentStudentID = Int32::Parse(Console::ReadLine()); Console::Write(S"Enter The Test One Score:") ; nMark1 = Int32::Parse(Console::ReadLine()); Console::Write(S"Enter The Test One Score:") ; nMark2 = Int32::Parse(Console::ReadLine()); //Now Caculate Avg flAvg = (float) (nMark1 + nMark2 )/ 2 ; if( flMaxAvg < flAvg ) { flMaxAvg = flAvg; nStudentID = nCurrentStudentID; // Now Calculate The Grade if ( flMaxAvg >= 50 && flMaxAvg < 60 ) //D- Grade 50-59 { strGrade = "D" ;} else if ( flMaxAvg >= 60 && flMaxAvg < 70 ) // C- Grade 60-69 { strGrade = "C" ;} else if ( flMaxAvg >= 70 && flMaxAvg < 80 ) // B- Grade 70-79 { strGrade = "B" ;} else if ( flMaxAvg >= 80 && flMaxAvg < 90 ) // A- Grade 80-89 { strGrade = "A" ;} else if ( flMaxAvg >= 90 && flMaxAvg <= 100 ) // S- Grade 90-100 { strGrade = "A" ;} else { strGrade = "F" ; } } } Console::Write(S"Student ID Is:" ); Console::Write(nStudentID.ToString()); Console::Write(S"Highest Avg is:"); Console::Write( flMaxAvg.ToString()); Console::Write(S" Grade:"); Console::Write(strGrade); Console::ReadLine(); return 0; } by baijumax:-D

        B Offline
        B Offline
        benibo
        wrote on last edited by
        #3

        your code gave me an error:LNK2019 unresolved external symbol_main refferenced in function_main CRT startup fatal error LNK1120: 1 unresolved external

        B 1 Reply Last reply
        0
        • B benibo

          your code gave me an error:LNK2019 unresolved external symbol_main refferenced in function_main CRT startup fatal error LNK1120: 1 unresolved external

          B Offline
          B Offline
          BAIJUMAX
          wrote on last edited by
          #4

          Hi, I believe problem with your project file. do one thing start vc.net then select managed c++ Application. it will create main method; cut and paste the code inside sample codes main. by baijumax;P

          B 1 Reply Last reply
          0
          • B BAIJUMAX

            Hi, I believe problem with your project file. do one thing start vc.net then select managed c++ Application. it will create main method; cut and paste the code inside sample codes main. by baijumax;P

            B Offline
            B Offline
            benibo
            wrote on last edited by
            #5

            Hey thanks but i was able to resolve the issue.It was a very simple one at that and was totally my mistake.I for got to #include tchar.h

            1 Reply Last reply
            0
            • B BAIJUMAX

              // Written By Baiju Max //EMail:- Baijumax@gmail.com,baijumax@yahoo.com hi man, enjoy coding .see below solution for u r problem. #include "stdafx.h" #using #include using namespace System; int _tmain(void) { int nMark1(0),nMark2(0),nStudentID(0),nCurrentStudentID(0); float flAvg(0),flMaxAvg(0); String* strGrade = new String("No Grade"); //Read The Input From The User for ( int iIndex = 0 ; iIndex < 2 ; iIndex ++ ) { Console::Write(S"Pl's Enter The Student ID:"); nCurrentStudentID = Int32::Parse(Console::ReadLine()); Console::Write(S"Enter The Test One Score:") ; nMark1 = Int32::Parse(Console::ReadLine()); Console::Write(S"Enter The Test One Score:") ; nMark2 = Int32::Parse(Console::ReadLine()); //Now Caculate Avg flAvg = (float) (nMark1 + nMark2 )/ 2 ; if( flMaxAvg < flAvg ) { flMaxAvg = flAvg; nStudentID = nCurrentStudentID; // Now Calculate The Grade if ( flMaxAvg >= 50 && flMaxAvg < 60 ) //D- Grade 50-59 { strGrade = "D" ;} else if ( flMaxAvg >= 60 && flMaxAvg < 70 ) // C- Grade 60-69 { strGrade = "C" ;} else if ( flMaxAvg >= 70 && flMaxAvg < 80 ) // B- Grade 70-79 { strGrade = "B" ;} else if ( flMaxAvg >= 80 && flMaxAvg < 90 ) // A- Grade 80-89 { strGrade = "A" ;} else if ( flMaxAvg >= 90 && flMaxAvg <= 100 ) // S- Grade 90-100 { strGrade = "A" ;} else { strGrade = "F" ; } } } Console::Write(S"Student ID Is:" ); Console::Write(nStudentID.ToString()); Console::Write(S"Highest Avg is:"); Console::Write( flMaxAvg.ToString()); Console::Write(S" Grade:"); Console::Write(strGrade); Console::ReadLine(); return 0; } by baijumax:-D

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              Don't do peoples homework for them, it doesn't help them in the long run. Also, u and r are letters, they are not words. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

              B 1 Reply Last reply
              0
              • C Christian Graus

                Don't do peoples homework for them, it doesn't help them in the long run. Also, u and r are letters, they are not words. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

                B Offline
                B Offline
                BAIJUMAX
                wrote on last edited by
                #7

                hi, Sorry About That.I accept your comment. by baijumax:((

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups