1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nadusha1986 [10]
3 years ago
11

Write a program "addnumbers.c" where it takes as many arguments as the user includes as command line arguments and calculates th

e sum of all numbers entered, and prints it. You will find using function atoi() from stdlib.h library helpful, where it converts the string representation of an integral number to an int value. Compile it on a lab machine and run it using command line.

Computers and Technology
1 answer:
gogolik [260]3 years ago
8 0

Answer:

#include <stdio.h>

#include <stdlib.h>

int main(int argc, char* argv[])

{

int first, second, total;

if (argc < 2)//checking if there are enough arguments

{

 printf("not enough values\n");

 return -1;//terminate program

}

total = 0;

for (int i = 1; i < argc; i++)

{

 //atoi convert a string into int. doing this to use operator

 total = total + atoi(argv[i]);//add current total to next argumment

}

printf("final total sum: %d\n", total);//printing final total

return 0;

}

Explanation:

For command line arguments you have to use command prompt. It varies depending on you machine and where you code is placed.

So, go to command line, called "command prompt" on Windows. This should open the black screen, also called the Terminal. A picture is attached in the answer. Then you have to NAVIGATE to the directory of your program. So, let's say your code is on your desktop. You will have to navigate to your desktop. To do this, type:

"cd Desktop", and press enter.

The picture of my process is attached below too.

Then, the program we have made is called addnumbers. we will type,

"addnumbers 10 20 30 40 50"

add numbers is the name of the program followed by arguments, separated with spaces.

You might be interested in
Write a program in C/C++ to draw the following points: (0.0,0.0), (20.0,0.0), (20.0,20.0), (0.0,20.0) and (10.0,25.0). For this
Fed [463]

Introductory program; just a static picture of a colored triangle.
Shows how to use GLUT.
Has minimal structure: only main() and a display callback.
Uses only the default viewing parameters (in fact, it never mentions viewing at all). This is an orthographic view volume with bounds of -1..1 in all three dimensions.
Draws only using glColor and glVertex within glBegin and glEnd in the display callback.
Uses only the GL_POLYGON drawing mode.
Illustrates glClear and glFlush.
triangle.cpp
// A simple introductory program; its main window contains a static picture
// of a triangle, whose three vertices are red, green and blue. The program
// illustrates viewing with default viewing parameters only.

#ifdef __APPLE_CC__
#include
#else
#include
#endif

// Clears the current window and draws a triangle.
void display() {

// Set every pixel in the frame buffer to the current clear color.
glClear(GL_COLOR_BUFFER_BIT);

// Drawing is done by specifying a sequence of vertices. The way these
// vertices are connected (or not connected) depends on the argument to
// glBegin. GL_POLYGON constructs a filled polygon.
glBegin(GL_POLYGON);
glColor3f(1, 0, 0); glVertex3f(-0.6, -0.75, 0.5);
glColor3f(0, 1, 0); glVertex3f(0.6, -0.75, 0);
glColor3f(0, 0, 1); glVertex3f(0, 0.75, 0);
glEnd();

// Flush drawing command buffer to make drawing happen as soon as possible.
glFlush();
}

// Initializes GLUT, the display mode, and main window; registers callbacks;
// enters the main event loop.
int main(int argc, char** argv) {

// Use a single buffered window in RGB mode (as opposed to a double-buffered
// window or color-index mode).
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);

// Position window at (80,80)-(480,380) and give it a title.
glutInitWindowPosition(80, 80);
glutInitWindowSize(400, 300);
glutCreateWindow("A Simple Triangle");

// Tell GLUT that whenever the main window needs to be repainted that it
// should call the function display().
glutDisplayFunc(display);

// Tell GLUT to start reading and processing events. This function
// never returns; the program only exits when the user closes the main
// window or kills the process.
glutMainLoop();
}
6 0
3 years ago
0.0% complete question a forensics analyst is attempting a live acquisition of the contents of the memory of a running linux dev
Sonja [21]

Based on the question, the  Recommendation of  a framework that will enable the analyst to install a kernel driver is said to be Volatility.

<h3>What is the Volatility framework?</h3>

Volatility is said to be a kind of an open source framework that is known to be used in times of memory forensics as well as digital investigations.

Note that The framework is one that tends to inspects and take out the memory artifacts that pertains to 32-bit and 64-bit systems. The framework has aided for all kinds of Linux, Windows, and others.

Hence, Based on the question, the  Recommendation of  a framework that will enable the analyst to install a kernel driver is said to be Volatility.

Learn more about Volatility from

brainly.com/question/27993482

#SPJ1

8 0
2 years ago
Describe the third generation of computers​
djverab [1.8K]

Answer:

The period of third generation was from 1965-1971. The computers of third generation used Integrated Circuits (ICs) in place of transistors. A single IC has many transistors, resistors, and capacitors along with the associated circuitry.

The IC was invented by Jack Kilby. This development made computers smaller in size, reliable, and efficient. In this generation remote processing, time-sharing, multiprogramming operating system were used. High-level languages (FORTRAN-II TO IV, COBOL, PASCAL PL/1, BASIC, ALGOL-68 etc.) were used during this generation.

Third Generation

The main features of third generation are −

IC used

More reliable in comparison to previous two generations

Smaller size

Generated less heat

Faster

Lesser maintenance

Costly

AC required

Consumed lesser electricity

Supported high-level language

Some computers of this generation were −

IBM-360 series

Honeywell-6000 series

PDP (Personal Data Processor)

IBM-370/168

TDC-316

3 0
3 years ago
How do you construct a JK Flip-flop from a T Flip-flop?
Ainat [17]
<span>Its very simple. All you have to do is short J and K inputs i.e. same inputs go into both J and K.
</span><span>Actually T flip flop is the special case of J-K flip flop when both the inputs of J-K flip flop are equal to 1 ( or logic high) j=k=1. Know electronics has well explained about its designing. A very good use of this flip flop or J=K=1 condition is in counters.

</span><span>The J-K flip flop is universal and can be used to make any of the other times. I agree with know electronics and VKP that it can be used in counters. Adding the practical use of conversion here . When you are working on ASIC or SOC Design, In the ECO stage if you want T or D flipflop and you have only JK flipflops then this conversion techniques can be helpful. similarly MUX conversions are helpful in realizing computational gates</span>

5 0
3 years ago
Which three are true about converting tabular, summary, or matrix report to a joined report?Choose 3 answersA.Report formula fie
Maurinko [17]

Answer:

Option B, C, and D is the correct options to the following question.

Explanation:

Because the joined report is that type of report which consists of the different standards of data or custom method types of report, in which user can add new accounts to the joined account or report. The joined reports do not support the display filter to the rows and it also not support the bucket field and the cross filters. So, that's why the following option is true.

3 0
4 years ago
Other questions:
  • Write a C++ program that searches for anagrams in a dictionary. An anagram is a word obtained by scrambling the letters of some
    5·1 answer
  • Use a spreadsheet to solve this business problem. The owners of an electronics store want to find which of their products makes
    12·1 answer
  • Question 4 (1 point)
    12·1 answer
  • (C Language) Write a program to display a histogram based on a number entered by the user. A histogram is a graphical representa
    7·1 answer
  • A security analyst believes an employee's workstation has been compromised. The analyst reviews the system logs, but does not fi
    7·2 answers
  • If someone runs a red light in front of you and you choose not to slow down or steer away you will
    8·1 answer
  • When you call a method with a parameter list, the arguments in the argument list Select one: a. must be coded in the same sequen
    15·1 answer
  • This is used to copy information from cell to cell in the spread sheet
    7·1 answer
  • Assume a branch instruction bne $t1, $t2, Label is located in 0x00001840 in the instruction memory. The 16-bits branch address i
    6·1 answer
  • Anyone know how to do Calculator program in python ?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!