Visual studio fatal error lnk1120

Microsoft visual studio fatal error lnk1120 This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions. Answered by: Question Answers >I get the error message >»fatal error LNK1120: 1 unresolved externals» You need to be more precise when posting errors, by using Windows copy & paste to post the *complete* […]

Содержание

  1. Microsoft visual studio fatal error lnk1120
  2. Answered by:
  3. Question
  4. Answers
  5. All replies
  6. Microsoft visual studio fatal error lnk1120
  7. Answered by:
  8. Question
  9. Answers
  10. Microsoft visual studio fatal error lnk1120
  11. Answered by:
  12. Question
  13. Answers
  14. All replies
  15. Microsoft visual studio fatal error lnk1120
  16. Answered by:
  17. Question
  18. Microsoft visual studio fatal error lnk1120
  19. Answered by:
  20. Question
  21. Answers
  22. All replies

Microsoft visual studio fatal error lnk1120

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

Answers

>I get the error message
>»fatal error LNK1120: 1 unresolved externals»

You need to be more precise when posting errors, by
using Windows copy & paste to post the *complete*
and *exact* message(s).

>The error arises only when
>cliext::vector ^c; is added.

Well, that line *by itself* may cause a link error.
Consider these examples:

#include «stdafx.h»
#include
using namespace System;

ref class SomeClass
<

#include «stdafx.h»
#include
using namespace System;

ref class SomeClass
<

int main(array ^args)
<
// Builds without errors:
cliext::vector c;
return 0;
>

#include «stdafx.h»
#include
using namespace System;

ref class SomeClass
<

int main(array ^args)
<
// Builds without errors:
cliext::vector ^c =
gcnew(cliext::vector );
return 0;
>

#include «stdafx.h»
#include
using namespace System;

ref class SomeClass
<

int main(array ^args)
<
// Builds without errors:
cliext::vector ^c;
c = gcnew(cliext::vector );
return 0;
>

It is much better to show the full error message that the linker gives you and your code if possible, the actual symbol that it is missing is displayed on the line before.

Does creating a new windows forms application and just building it without adding any code produce the same error?

This is a signature

Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

Do you want Visual Studio 11 Express to be freely installable on Windows 7 and able to write regular C++ applications? Please vote for this.

Источник

Microsoft visual studio fatal error lnk1120

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

1> Skipping task because its outputs are up-to-date.

1>MSVCRTD.lib(wcrtexe.obj) : error LNK2019: unresolved external symbol wmain referenced in function __tmainCRTStartup this is what my error is can someone help me

Answers

change the «subsystem» in your linker settings from «Windows» to «Console» Or if it is a UNICODE build, use wWinMainCRTStartup as entry point in the linker properties.

Linker Tools Error LNK2019
Error Message
unresolved external symbol ‘symbol’ referenced in function ‘function’
An undefined external symbol (symbol) was found in function. To resolve this error, provide a definition for symbol or remove the code that references it. For more information, see,Function

Automatic (function scope) variables

Missing function body or variable

Common problems that cause LNK2019 include:

The declaration of the symbol contains a spelling mistake, such that, it is not the same name as the definition of the symbol.

A function was used but the type or number of the parameters did not match the function definition.

The calling convention (__cdecl, __stdcall, or __fastcall) differs on the use of the function declaration and the function definition.

Symbol definitions are in a file that was compiled as a C program and symbols are declared in a C++ file without an extern «C» modifier. In that case, modify the declaration, for example, instead of:

Copy Code extern int i;
extern void g();use:

Copy Code extern «C» int i;
extern «C» void g();

for more info look here

Knowledge is like light; It spreads only when you have clear and transparent mind. — Sreedhar dv

Источник

Microsoft visual studio fatal error lnk1120

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

Answers

>I get the error message
>»fatal error LNK1120: 1 unresolved externals»

You need to be more precise when posting errors, by
using Windows copy & paste to post the *complete*
and *exact* message(s).

>The error arises only when
>cliext::vector ^c; is added.

Well, that line *by itself* may cause a link error.
Consider these examples:

#include «stdafx.h»
#include
using namespace System;

ref class SomeClass
<

#include «stdafx.h»
#include
using namespace System;

ref class SomeClass
<

int main(array ^args)
<
// Builds without errors:
cliext::vector c;
return 0;
>

#include «stdafx.h»
#include
using namespace System;

ref class SomeClass
<

int main(array ^args)
<
// Builds without errors:
cliext::vector ^c =
gcnew(cliext::vector );
return 0;
>

#include «stdafx.h»
#include
using namespace System;

ref class SomeClass
<

int main(array ^args)
<
// Builds without errors:
cliext::vector ^c;
c = gcnew(cliext::vector );
return 0;
>

It is much better to show the full error message that the linker gives you and your code if possible, the actual symbol that it is missing is displayed on the line before.

Does creating a new windows forms application and just building it without adding any code produce the same error?

This is a signature

Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

Do you want Visual Studio 11 Express to be freely installable on Windows 7 and able to write regular C++ applications? Please vote for this.

Источник

Microsoft visual studio fatal error lnk1120

Answered by:

Question

I recently downloaded Microsoft Visual C++ 2010 Express. I created a new file and entered this code:

// my first program in C++

#include
using namespace std;

int main ()
<
cout —— Build started: Project: my_first_cpp_project, Configuration: Debug Win32 ——
1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1>c:usersjakedocumentsvisual studio 2010Projectsmy_first_cpp_projectDebugmy_first_cpp_project.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I’ve seen this problem discussed elsewhere on the internet, but never in terms I can understand. Please keep in mind I have NO programming experience whatsoever, so the terms «linkers» and «libraries» are meaningless to me. In addition to telling me what’s going on, could someone also tell me where I can find a good, easy-to-use C++ tutorial? All the tutorials I’ve tried to use so far use terms in the first few sentences that already have me confused.

Источник

Microsoft visual studio fatal error lnk1120

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

Answers

>I get the error message
>»fatal error LNK1120: 1 unresolved externals»

You need to be more precise when posting errors, by
using Windows copy & paste to post the *complete*
and *exact* message(s).

>The error arises only when
>cliext::vector ^c; is added.

Well, that line *by itself* may cause a link error.
Consider these examples:

#include «stdafx.h»
#include
using namespace System;

ref class SomeClass
<

#include «stdafx.h»
#include
using namespace System;

ref class SomeClass
<

int main(array ^args)
<
// Builds without errors:
cliext::vector c;
return 0;
>

#include «stdafx.h»
#include
using namespace System;

ref class SomeClass
<

int main(array ^args)
<
// Builds without errors:
cliext::vector ^c =
gcnew(cliext::vector );
return 0;
>

#include «stdafx.h»
#include
using namespace System;

ref class SomeClass
<

int main(array ^args)
<
// Builds without errors:
cliext::vector ^c;
c = gcnew(cliext::vector );
return 0;
>

It is much better to show the full error message that the linker gives you and your code if possible, the actual symbol that it is missing is displayed on the line before.

Does creating a new windows forms application and just building it without adding any code produce the same error?

This is a signature

Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

Do you want Visual Studio 11 Express to be freely installable on Windows 7 and able to write regular C++ applications? Please vote for this.

Источник

Frankie Avalon

4 / 4 / 0

Регистрация: 14.10.2012

Сообщений: 64

1

14.10.2012, 19:48. Показов 4847. Ответов 5

Метки нет (Все метки)


Всем привет. При компиляции выбивает такую ошибку:

C++
1
2
1>LINK : error LNK2001: неразрешенный внешний символ "_mainCRTStartup"
1>c:users1documentsvisual studio 2010Projects111111Debug111111.exe : fatal error LNK1120: 1 неразрешенных внешних элементов

что может быть не так? пока в с++ не силен.

сам код:

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "stdafx.h"
#include <stdio.h>
#include <math.h>
void main (void)
  {
    double k,z,n,i,alpha;
    long double a;
 printf("Vvedite k: n");
 scanf("%f",k);
    printf("Vvedite z: n"); 
 scanf("%f",z);
    printf("Vvedite i: n"); 
 scanf("%d",i);
 
 n=pow(pow(1-pow(z,3),2),0.2));
 alpha=pow(3,i)-1;
 a=(pow(z,2)+k*n+13.44*pow(10,-5))/(fabs(pow(n,2)+pow(z,2)-24.5)*pow(sin,3)(alpha*z));
 
 
 printf( "alpha: " alpha);
 printf( "a: " a);
 
 return 0;
  }

Миниатюры

fatal error LNK1120
 

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



1499 / 1145 / 165

Регистрация: 05.12.2011

Сообщений: 2,279

14.10.2012, 20:04

2

тип проекта с самого начала неверно задан.
еще раз создайте новый проект. тип проекта — консольное win32 приложение.
студия с самого начала в него добавит main и заголовочные файлы. вот это сперва соберите, чтобы не было ошибок линковки. потом уже туда скопируйте свой код.



1



Frankie Avalon

4 / 4 / 0

Регистрация: 14.10.2012

Сообщений: 64

14.10.2012, 20:19

 [ТС]

3

сделал уже с готовыми заголовками, теперь куча ошибок:

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
1>c:users1documentsvisual studio 2010projectslaba1laba1laba1.cpp(20): error C2059: синтаксическая ошибка: )
1>c:users1documentsvisual studio 2010projectslaba1laba1laba1.cpp(22): error C2668: pow: неоднозначный вызов перегруженной функции
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(583): может быть "long double pow(long double,int)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(535): или       "float pow(float,int)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(497): или       "double pow(double,int)"
1>          при попытке сопоставить список аргументов "(int, int)"
1>c:users1documentsvisual studio 2010projectslaba1laba1laba1.cpp(22): error C2665: pow: ни одна из 6 перегрузок не может преобразовать все типы аргументов
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(122): может быть "double pow(double,double)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(497): или       "double pow(double,int)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(533): или       "float pow(float,float)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(535): или       "float pow(float,int)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(581): или       "long double pow(long double,long double)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(583): или       "long double pow(long double,int)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(122): или       "double pow(double,double)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(497): или       "double pow(double,int)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(533): или       "float pow(float,float)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(535): или       "float pow(float,int)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(581): или       "long double pow(long double,long double)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(583): или       "long double pow(long double,int)"
1>          при попытке сопоставить список аргументов "(overloaded-function, int)"
1>c:users1documentsvisual studio 2010projectslaba1laba1laba1.cpp(25): error C2146: синтаксическая ошибка: отсутствие ")" перед идентификатором "alpha"
1>c:users1documentsvisual studio 2010projectslaba1laba1laba1.cpp(25): error C2059: синтаксическая ошибка: )
1>c:users1documentsvisual studio 2010projectslaba1laba1laba1.cpp(26): error C2146: синтаксическая ошибка: отсутствие ")" перед идентификатором "a"
1>c:users1documentsvisual studio 2010projectslaba1laba1laba1.cpp(26): error C2059: синтаксическая ошибка: )
1>c:users1documentsvisual studio 2010projectslaba1laba1laba1.cpp(28): error C2562: main: функция типа "void", возвращающая значение
1>          c:users1documentsvisual studio 2010projectslaba1laba1laba1.cpp(9): см. объявление "main"

вообщем ошибки со скобками и с командой пов, гляньте пожалуйста, как можно исправить.



0



1499 / 1145 / 165

Регистрация: 05.12.2011

Сообщений: 2,279

14.10.2012, 20:29

4

ну так исправте синтаксические ошибки кроме той, которая связана с неоднозначностью pow.
на воринги пока можете забить. в вашем случае это не ошибки. остальные достаточно простые и их описание нормальное. со скобками перепудрили и функцию main следайте возвращаюшей int:
int main()
{

return 0;
}



1



Frankie Avalon

4 / 4 / 0

Регистрация: 14.10.2012

Сообщений: 64

14.10.2012, 21:22

 [ТС]

5

Упростил немного, все-равно идет перегрузка пова.

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "stdafx.h"
#include <stdio.h>
#include <math.h>
using namespace std;
int main ()
  {
    double k,z,n,i,alpha,s;
    long double a;
 printf("Vvedite k: n");
 scanf("%lf",k);
    printf("Vvedite z: n"); 
 scanf("%lf",z);
    printf("Vvedite i: n"); 
 scanf("%lf",i);
 
 n=pow((pow(1-pow(z,3),2),0.2));
 alpha=pow(3,i)-1;
 a=(pow(z,2)+k*n+13.44*0.00001);
 s=(fabs(pow(n,2)+pow(z,2)-24.5)*pow(sin,3)(alpha*z));
 a=a/s;
 
 
 return 0;
  }
C++
1
2
3
4
5
6
7
8
9
1>c:users1documentsvisual studio 2010projects123123123123123123123123123123123123123123123123123123123123123123123123.cpp(16): error C2661: pow: нет перегруженной функции, принимающей 1 аргументов
1>c:users1documentsvisual studio 2010projects123123123123123123123123123123123123123123123123123123123123123123123123.cpp(19): error C2665: pow: ни одна из 6 перегрузок не может преобразовать все типы аргументов
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(122): может быть "double pow(double,double)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(497): или       "double pow(double,int)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(533): или       "float pow(float,float)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(535): или       "float pow(float,int)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(581): или       "long double pow(long double,long double)"
1>          c:program filesmicrosoft visual studio 10.0vcincludemath.h(583): или       "long double pow(long double,int)"
1>          при попытке сопоставить список аргументов "(overloaded-function, int)"

Можно как то без него обойтись? или что я не так делаю?



0



DU

1499 / 1145 / 165

Регистрация: 05.12.2011

Сообщений: 2,279

14.10.2012, 22:04

6

в 16 строке лишние скобочки по краям.
а чтобы избавится от неоднозначности, типа аргументов для функции pow должны быть одинаковыми.
например:

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  double d = 1;
  float f = 1;
  pow(d, f); // ошибка из-за неоднозначности
  // тут неоднозначность, потому что есть перегрузки функии
  // pow(double, double)  и pow(float, float) и компилятор не может
  // подобрать правильную функцию. потому что обе из них подходят
  // если он сделает с одним из аргументов преобразование. но т.к.
  // эти преобразования равнозначны, он ожидает, что нужное преобразование
  // укажет автор кода. поэтому нам нужно явно сделать так, чтобы типа обоих аргументов
  // были одинаковыми:
  pow(d, (double)f); // явное преобразование второго аргумента в double
  pow((float)d, f); // явное преобразование первого аргумента в float
  // такая проблема может возникать при комбинации разных типов, не только float и double
 
 //теперь выпишем проблемную строку (интересны только функции pow):
 //s=(fabs(pow(n,2)+pow(z,2)-24.5)*pow(sin,3)(alpha*z));
 pow(n,2); // ok
 pow(z,2); // ok
 pow(sin,3); // error
 
// вопрос: что такое sin? хз что вы имели в виду, но компилятор знает что есть функция sin
// и он пытается сделать вызов функции pow передавая ей в качестве первого аргумента
// указатель на функцию, которая требует преобазования в один из числовых типов ну и там
// возникают всякие неоднозначности. вот эту строку и нужно подправить. что такое sin?
// может вы хотели вызвать эту функцию с каким нибудь аргументом? типа так:
 pos(sin(alpha*z), 3); ?
 
// и кстати в исходном выражении запись
 pow(sin,3)(alpha*z) - неверная. отгадайте сами почему.

и еще совет на будущее: не пишите такие длинные выражение в одну строку. в них трудно искать ошибки как во время компиляции, так и во время выполнения.
при ошибках компиляции компилятор ругается на все такое выражение и ошибку уже приходится в нем искать глазами. а там много скобочек и прочих знаков,
поиск затруднен. разбивайте выражение на части и считайте все по кусочкам. вот тут примерно я об этом говорил. там выражение по проще, но принцып тот же
sinlnb3b3 и следующее корень пятой степени, где под корнем b3+10



1



Member Avatar

11 Years Ago

This program is to enter the scores, get the grades, and display the result.
However, I get a fatal error LNK1120: 1 unresolved externals
Does anyone know how to solve this problem?

#include <iostream>
#include <iomanip>
using namespace std;

// Function prototype
void letter(double score, double resultNum, char grade); //recieve grade
double calc_average(double sum, double num);
char grade[10];
double score[10];

double resultNum = 0;
int i = 1; // for visual appeal
int total_times =1;
double avg = 0;
double sum = 0;
double high = 0;
double low = 100;

double jjj;

int main()
{
	do
	{
		cout << "Enter result " << i << " (or -1 if no more results) ";
		cin >> score[i];
		jjj = score[i];
		if(score[i]!=-1)
		{
			sum=sum+jjj; //save inputs before continuing
			if (jjj>high)
				high = jjj; //check for high grades

			if (jjj<low)
				low = jjj; //check for low grades

			resultNum++; //used to divide average
			
			letter(score[i], resultNum, grade[i]); //recieve grade
			i++;
			total_times = i;
		}
	}while (score[i] !=-1);

	////////////////////////////////////////////////////////
	cout << "nThe list of the results and grades are: " << endl; 

	for ( i= 1; i < total_times; i++)

		cout << "Result " << i << ": " << score[i] << "t  Grade: " << grade[i] << endl;
		
	//////////////////////////////////////////////////////////

	//calc_average function for beautiful clean code
	cout << "nThe Average of the results = " << calc_average(sum,resultNum) << endl;
	cout << "The Lowest of the results = " << low << endl; 
	cout << "The Highest of the results = " << high << endl;
} 

double calc_average(double sum, double num)
{
	return (sum/num);
}

void letter(double score, double resultNum, int i)
{
	if (score<60)
	{
		cout << "Result " << resultNum << " is a Un" << endl;
		grade[i] = 'U';
	}
	if (score>=60 && score<70)
	{
		cout << "Result " << resultNum << " is a Cn" << endl;
		grade[i] = 'C';
	}
	if (score>=70 && score<90)
	{
		cout << "Result " << resultNum << " is a Bn" << endl;
		grade[i] = 'B';
	}
	if (score>=90)
	{
		cout << "Result " << resultNum << " is a An" << endl;
		grade[i] = 'A';
	}
}

Edited

11 Years Ago
by chuyauchi because:

n/a


Recommended Answers

that error means the linker cannot find some or all of the libraries it needs to do its job, you’ll need to check your compiler/linker documentation and installation to figure out how to make those known.

Jump to Post

All 6 Replies

Member Avatar

jwenting

1,855



duckman



Team Colleague


11 Years Ago

that error means the linker cannot find some or all of the libraries it needs to do its job, you’ll need to check your compiler/linker documentation and installation to figure out how to make those known.

Member Avatar

11 Years Ago

Addition error message:

1>test.obj : error LNK2019: unresolved external symbol «void __cdecl letter(double,double,char)» (?letter@@YAXNND@Z) referenced in function _main
1>c:usersadministratordocumentsvisual studio 2010ProjectstestDebugtest.exe : fatal error LNK1120: 1 unresolved externals


========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Member Avatar

11 Years Ago

#include <iostream>
#include <iomanip>
using namespace std;

// Function prototype
 char grade[10];
double score[10];

double resultNum = 0;
int i = 1; // for visual appeal
int total_times =1;
double avg = 0;
double sum = 0;
double high = 0;
double low = 100;

double jjj;
double calc_average(double sum, double num)
{
    return (sum/num);
}

void letter(double score, double resultNum, int i)
{
    if (score<60)
    {
        cout << "Result " << resultNum << " is a Un" << endl;
        grade[i] = 'U';
    }
    if (score>=60 && score<70)
    {
        cout << "Result " << resultNum << " is a Cn" << endl;
        grade[i] = 'C';
    }
    if (score>=70 && score<90)
    {
        cout << "Result " << resultNum << " is a Bn" << endl;
        grade[i] = 'B';
    }
    if (score>=90)
    {
        cout << "Result " << resultNum << " is a An" << endl;
        grade[i] = 'A';
    }

}


int main()
{
    do
    {
        cout << "Enter result " << i << " (or -1 if no more results) ";
        cin >> score[i];
        jjj = score[i];
        if(score[i]!=-1)
        {
            sum=sum+jjj; //save inputs before continuing
            if (jjj>high)
                high = jjj; //check for high grades

            if (jjj<low)
                low = jjj; //check for low grades

            resultNum++; //used to divide average

            letter(score[i], resultNum, grade[i]); //recieve grade
            i++;
            total_times = i;
        }
    }while (score[i] !=-1);

    ////////////////////////////////////////////////////////
    cout << "nThe list of the results and grades are: " << endl; 

    for ( i= 1; i < total_times; i++)

        cout << "Result " << i << ": " << score[i] << "t  Grade: " << grade[i] << endl;

    //////////////////////////////////////////////////////////

    //calc_average function for beautiful clean code
    cout << "nThe Average of the results = " << calc_average(sum,resultNum) << endl;
    cout << "The Lowest of the results = " << low << endl; 
    cout << "The Highest of the results = " << high << endl;
        return 0;
}

Edited

10 Years Ago
by Nick Evan because:

Fixed formatting

Member Avatar

11 Years Ago

Edited

11 Years Ago
by chuyauchi because:

n/a

Member Avatar

11 Years Ago

#include <iostream>
#include <iomanip>
using namespace std;

// Function prototype
 char grade[10];
double score[10];

double resultNum = 0;
int i = 1; // for visual appeal
int total_times =1;
double avg = 0;
double sum = 0;
double high = 0;
double low = 100;

double jjj;
double calc_average(double sum, double num)
{
    return (sum/num);
}

void letter(double score, double resultNum, int i)
{
    if (score<60)
    {
        cout << "Result " << resultNum << " is a Un" << endl;
        grade[i] = 'U';
    }
    if (score>=60 && score<70)
    {
        cout << "Result " << resultNum << " is a Cn" << endl;
        grade[i] = 'C';
    }
    if (score>=70 && score<90)
    {
        cout << "Result " << resultNum << " is a Bn" << endl;
        grade[i] = 'B';
    }
    if (score>=90)
    {
        cout << "Result " << resultNum << " is a An" << endl;
        grade[i] = 'A';
    }

}


int main()
{
    do
    {
        cout << "Enter result " << i << " (or -1 if no more results) ";
        cin >> score[i];
        jjj = score[i];
        if(score[i]!=-1)
        {
            sum=sum+jjj; //save inputs before continuing
            if (jjj>high)
                high = jjj; //check for high grades

            if (jjj<low)
                low = jjj; //check for low grades

            resultNum++; //used to divide average

            letter(score[i], resultNum, i); //recieve grade
            i++;
            total_times = i;
        }
    }while (score[i] !=-1);

    ////////////////////////////////////////////////////////
    cout << "nThe list of the results and grades are: " << endl; 

    for ( i= 1; i < total_times; i++)

        cout << "Result " << i << ": " << score[i] << "t  Grade: " << grade[i] << endl;

    //////////////////////////////////////////////////////////

    //calc_average function for beautiful clean code
    cout << "nThe Average of the results = " << calc_average(sum,resultNum) << endl;
    cout << "The Lowest of the results = " << low << endl; 
    cout << "The Highest of the results = " << high << endl;
    system("pause");
        return 0;
}

Edited

10 Years Ago
by Nick Evan because:

Fixed formatting

Member Avatar

11 Years Ago

Thank you very much. You solved my problem.


Reply to this topic

Be a part of the DaniWeb community

We’re a friendly, industry-focused community of developers, IT pros, digital marketers,
and technology enthusiasts meeting, networking, learning, and sharing knowledge.

Понравилась статья? Поделить с друзьями:
  • Visual studio fatal error lnk1104
  • Vip персона лексическая ошибка
  • Visual studio error msb8020
  • Vip skins error
  • Visual studio error lnk2019 ссылка на неразрешенный внешний символ