Question

In: Computer Science

What are the types of 5th generation languages write code in each of those languages and...

What are the types of 5th generation languages write code in each of those languages and please provide output also

thank you

Solutions

Expert Solution

There are four types of 5th generation languages:

(A). Procedural language: It is a structured programming language in which the code is written as sequence of instructions.

code: #include<stdio.h>

int main() {

int n1, n2, sum;

printf("enter the numbers ");

scanf("%d %d", &n1,&n2);

sum=n1+n2;

printf("%d+%d=%d", n1, n2, sum);

return 0;

}

output:

enter the numbers 5

6

5+6=11

(B). Object-Oriented Language: This use objects to store data and code instead of functions.In this language, we can define the data type of a data structure and the type of operations that can be applied to the data structure

code:

#include <iostream>
using namespace std;

int main()
{
int firstNumber, secondNumber, sumOfTwoNumbers;
  
cout << "Enter two integers: ";
cin >> firstNumber >> secondNumber;

// sum of two numbers in stored in variable sumOfTwoNumbers
sumOfTwoNumbers = firstNumber + secondNumber;

// Prints sum
cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;   

return 0;
}

output:

Enter two integers: 6

8

6+8=14

(C). Functional Programming language: It is based on mathematical functions.

code:

#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;

int main() {   
char str[20] = "Hello World";
int len;
len = strlen(str);
cout<<"String length is: "<<len;
return 0;
}

output:

String length is: 11

(D). Logical programming languages: Logic programming is a programming strategy that uses logic circuits to control how facts and rules are expressed, rather than only mathematical functions.

code:

#include <stdio.h>

int main() {
int a = 1;
int b = 0;

if ( a && b ) {
  
printf("This will never print because condition is false\n" );
}
if ( a || b ) {
  
printf("This will be printed print because condition is true\n" );
}
if ( !(a && b) ) {
  
printf("This will be printed print because condition is true\n" );
}
}

output:

This will be printed print because condition is true
This will be printed print because condition is true


Related Solutions

1. Write code in mips that will play battleships. Include comments in code on what each...
1. Write code in mips that will play battleships. Include comments in code on what each part is doing.
Formal Languages Give a regular expression for each of the following languages: L2a = {w ?...
Formal Languages Give a regular expression for each of the following languages: L2a = {w ? {0,1}* | w corresponds to the binary encoding of non-negative integers that are evenly divisible by 4 L2b = {w ? {a,b}* | w contains at least one 'a' and exactly two b's} L2c = {w ? {0, 1, 2}* | w starts with a 2, ends with a 1 and contains an even number of 0's}.
Write a code in C that will take four words from the user and show those...
Write a code in C that will take four words from the user and show those in ascending order.
What is the output of the code below? After each line that has a cout, write...
What is the output of the code below? After each line that has a cout, write what the output of the code is. See example in code below. int i = 2, j = 1, k = i + j; cout << k << endl; ➔ 3 double d = 2.99, e = 1, f = d + e; cout << f << endl; double q = 1.50; cout << q/3 << endl; cout << 6.0/4 << endl; char c...
Write the code to return the output in Rstudio. What is the code? Code: x <-...
Write the code to return the output in Rstudio. What is the code? Code: x <- c(28, 69, 5, 88, 19, 20) Output must be: [1] 4 2 1 6 5 3
Write an essay about the primary use of the Programming Languages
Write an essay about the primary use of the Programming Languages
According to your textbook, there are two types of love. Identify what those types of love...
According to your textbook, there are two types of love. Identify what those types of love are. Compare and contrast the two types of love. In your description, provide an example from either your own life or in the media that illustrates the two.
I need to write a c/c++ code to find the maximum sum in those possible combinations...
I need to write a c/c++ code to find the maximum sum in those possible combinations of arrays. There are N arrays with S elements. ex2: 4 arrays with 3 elements.We want to find the greater number in the same column of two arrays(may possible be three or four...arrays), and sum those greater number to find the greatest sum in all of the combinations in those 4 arrays, like: A: [50, 60, 70] B: [80, 40, 20] C: [30, 100,...
Write the types of spillway and explain each briefly.
Write the types of spillway and explain each briefly.
What are two of the distinguishing aspects of next generation sequencing (NGS) compared to earlier types...
What are two of the distinguishing aspects of next generation sequencing (NGS) compared to earlier types of sequencing? Explain an advantage and a disadvantage to using next generation sequencing.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT