Question about Advanced Graphics Programming Using OpenGL

1 Answer

Twenty-five numbers are entered from the keyboard into an array.The number to be searched is entered through the keyboard by user.Write a program to find if the number to be searched is present in the array and if it is present,display the number of times it appears in the array.

Posted by on

Ad

1 Answer

  • Level 1:

    An expert who has achieved level 1.

    Hot-Shot:

    An expert who has answered 20 questions.

    Corporal:

    An expert that hasĀ over 10 points.

    Mayor:

    An expert whose answer gotĀ voted for 2 times.

  • Contributor
  • 27 Answers

Pseudo is
-> integer type count =0;
->Take input from user 'Number'
->loop from 0th to 24th element
->Compare each element with user entered number and if it matches then do count++.
finally display the count.

Posted on Aug 10, 2010

Ad

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Ad

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

2 Answers

Write a program that accept a number and output its equivalent in words.


Below is the program written in Turbo C.

#include<stdio.h>
void pw(long,char[]);
char *one[]={" "," one"," two"," three"," four"," five"," six"," seven","
eight"," Nine"," ten"," eleven"," twelve"," thirteen"," fourteen","
fifteen"," sixteen"," seventeen"," eighteen"," nineteen"};
char *ten[]={" "," "," twenty"," thirty"," forty"," fifty"," sixty","
seventy"," eighty"," ninety"};

void main()
{
long n;
clrscr();
printf("
Enter any 9 digit no: ");
scanf("%9ld",&n);
if(n<=0)
printf("Enter numbers greater than 0");
else
{
pw((n/10000000),"crore");
pw(((n/100000)%100),"lakh");
pw(((n/1000)%100),"thousand");
pw(((n/100)%10),"hundred");
pw((n%100)," ");
}
getch();
}

void pw(long n,char ch[])
{
(n>19)?printf("%s %s ",ten[n/10],one[n%10]):printf("%s ",one[n]);
if(n)printf("%s ",ch);
}

Aug 06, 2010 | Borland Turbo C++ Suite 1.0...

Tip

HOW TO COUNT THE OCCURRENCES OF A TEXT STRING


In the cell that you want the result to appear in, enter the appropriate formula from the following examples.
How to Count the Occurrences of a Number
Use this formula
=SUM(IF(range=number,1,0))
where range is the range that you want to search, and number is the number that you want to count.
NOTE: This formula must be entered as an array formula. To enter an array formula, press CTRL+SHIFT+ENTER.
How to Count the Occurrences of a Text String
Method 1
Use this formula
=SUM(IF(range="text",1,0))
where range is the range that you want to search, and text is the text that you want to find (the text must be enclosed in quotation marks).
NOTE: The above formula must be entered as an array formula. To enter an array formula, press CTRL+SHIFT+ENTER.
Method 2
Use the COUNTIF() function to count the occurrences of a text string. For example, use the formula
=COUNTIF(range,"text")
where range is the range of cells that you are evaluating, and text is the text string that you want to count instances of (note that text must be enclosed in quotation marks).
NOTE: This formula must be entered as an array formula. To enter an array formula, press CTRL+SHIFT+ENTER.
Wildcard characters can be used within the COUNTIF function.
The asterisk character (*) represents more than one character. For example, to count all the cells in the range a1:a10 that contain an "x," you can use the following formula:
=COUNTIF(a1:a10,"*x*")
The question mark character (?) can also be used to represent one wildcard character -- for example, to count all cells in the range whose second character is the letter, such as "ax" or "bx."
=COUNTIF(a1:a10,"?x*")

on Nov 11, 2013 | Microsoft Excel Computers & Internet

1 Answer

Hwo can i solved a bineary search problam in c++


first arrange your array in ascending order.and keep the two variables one for starting index and one for last index
then check your number with center(center = (first index + last index))/2 element of array.
if it is lager then center element then set first index = center,
if smaller then last index = center
else you got the number..

Jul 25, 2010 | Borland Turbo C++ Suite 1.0...

1 Answer

Make a program that will accept tthe size of an array (number must be greater than). Enter and fill the array with numbers then sort in descending order (largest to smallest). Display the unsorted and...



coding in C++

#include<iostream.h>
#include<conio.h>
#define max 50

void main()
{
clrscr();
int arr[max],size=0;
int i=0,j=0,temp;
do
{
cout<<"Enter the size of array(less than or equal to 50)";
cin>>size;
} while(size>50);

for(i=0;i<size;i++){
cout<<"Enter a number";
cin>>arr[i];
}


for( i=1;i<size;i++){
for(j=0;j<size;j++){
if(arr[j+1]>arr[j]){
temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;


}

}
}
cout<<”Array in descending order”;
for(i=0;i<size;i++){
cout<<arr[i]<<"\n";
}
getch();
return 0;
}

Mar 09, 2010 | Computers & Internet

2 Answers

C++ poker program


Hi.

I suggest creating an Array of Cards (cardOne,cardTwo,etc. to five)

If you can enter them in one at a time, after declaring the array, assign the values to the array.

cin < cardOne; (Psuedo code by the way, hope you don't mind)

Afterwards, you'll have an array with 5 cards.

Declare what full houses, flushes, etc would require.
Use an if statement (If you don't mind lots of code) to compare the entered Array against possible hands.

I didn't necessarily give you any specific C++ code. However, if you Google C++ user input, you should find plenty of commands that may help you.

Good Luck

(And not sure about Linear search to be honest, you can use a Linear search, but if you did it the way I explained, you just have to compare hand to a series of conditionals.)


Sep 23, 2009 | Computers & Internet

1 Answer

C++


http://www.cplusplus.com/doc/tutorial/

May 01, 2009 | Computers & Internet

1 Answer

Please Solve this C++ Program


Write a program to prompt the user to input several lines of input. A line of inputs is terminated by '*'. For each readline of input the program should output:(use pointer notation for the array) . The total # of words . The lenght of the longest word in the line At the end the program should output: . The total number of words read in all lines of input . The lenght of the longest word read in all lines of input

Jan 19, 2009 | Computers & Internet

1 Answer

Apex Digital GB4308 remote


Programming the Remote Control Remote-control switchover Press VCR/DVD, SAT/CABLE or AUX to select the device you want to control. To program the remote control Press and hold VCR.DVD, SAT/CABLE or AUX for over 2 seconds until the LED on the remote control turns off. Release the button the LED will light again (the remote control enters the PROGRAMMING mode). Enter three-digit code number for your equipment. If the correct code number is entered, the LED blinks three times. If you enter a code not listed below, or you press any other buttons than SEARCH and 100+, the LED turns off. To search codes Press ad hold VCR/DVD,SAT/CABLE or AUX for over 2 seconds unil the LED turns off. Release the button (the LED wil light again) and the remote control enters the PROGRAMMING mode. Press SEARCH. Press CH+/- to search codes downwards or upwards. Each time you press CH+/-, the code number decreases or increases by 1 while the remote control sends the code number for POWER button on your device. If the desired code number is found,press 100+ to program the code for your device until the LED blinks three times.Then the remote control exits from the PROGRAMMING mode and returns to norml operation. Or press any other button to exit from the PROGRAMMING mode after the LED blinks rapidly eight times, and the operation is not active. To check the current code number Press and hold VCR/DVD, SAT/CABLE or AUX for over 2 seconds until the LED turns off. Release the button (the LED will light again) and the remote control enters the PROGRAMMING mode. Press 100+ . You may read the code numder according to the LED display status as follows. * If there is no operation within 20 seconds during the steps mentioned above, the remote control will automatically exit from the appropriate operation. Code Number First - digit 0 1 0 1 Second - digit 0 0 4 5 Third - digit 0 6 3 0 First - digit Blinks rapidly once Blinks once Blinks rapidly once Bliks once Secod - digit Blinks rapidly once Blinks rapidly once Blinks four times Bliks five times Third - digit Blinks rapidly once Blinks six times Blinks three times Bliks rapidly once

Jan 05, 2007 | Apex Digital GB4308 43" Rear Projection...

Not finding what you are looking for?

Open Questions:

0 Answers

my code in opengl does not work can any one help me #include <string.h> #include <GL/glut.h> #include "math.h" float rotate =0.0; float start = 0.0; float z_dep = 0.0; int poi_size = 0; int poi_arr[100][2]; float rad_arr[50]; int m_x = 0; int m_y = 0; int rubber_band_on = 0; int down_flag = 0; #define MENU1 10 #define MENU2 11 #define MENU3 12 #define MENU4 13 #define MENU5 14 GLfloat r,g,b; GLint t=0 ; void sel(int item) { switch(item) { case MENU1: {r=1 , g=0 , b=0;} break; case MENU2: {r=0 , g=0 , b=1;} break; case MENU3: {r=0 , g=1 , b=0;} break; case MENU4: {t=1;} break; case MENU5: {t=2;} break; } glutPostRedisplay(); } void menu(void) { int MainMenu, SubMenu1,SubMenu2; SubMenu1=glutCreateMenu(sel); glutAddMenuEntry("red", MENU1); glutAddMenuEntry("bule", MENU2); glutAddMenuEntry("green", MENU3); SubMenu2=glutCreateMenu(sel); glutAddMenuEntry("line", MENU4); glutAddMenuEntry("circle", MENU5); MainMenu=glutCreateMenu(sel); glutAddSubMenu("Color", SubMenu1); glutAddSubMenu("Shap", SubMenu2); glutAttachMenu(GLUT_RIGHT_BUTTON); }void drawCircle(float radius, float x1, float y1) { float angle = 0; float x2,y2,cx,cy,fx,fy; int cache = 0; glBegin(GL_LINES); for (angle = 0; angle < 360; angle+=1.0) { float rad_angle = angle * 3.14 / 180; x2 = x1+radius * sin((double)rad_angle); y2 = y1+radius * cos((double)rad_angle); if (cache) { glVertex2f(cx,cy); glVertex2f(x2,y2); } else { fx = x2; fy = y2; } cache = 1; cx = x2; cy = y2; } glVertex2f(x2,y2); glVertex2f(fx,fy); glEnd(); } void tick(void) { glutPostRedisplay(); } void display1(void) { glClear(GL_COLOR_BUFFER_BIT); // Draw the lines created by user glBegin(GL_LINES); for(int i=0; i<poi_size; i++) { glVertex2f(poi_arr[i][0],poi_arr[i][1]); } if (rubber_band_on && (poi_size%2==1)) { glVertex2f(m_x,m_y); } glEnd(); glutSwapBuffers(); } void handleKeypress(unsigned char key, int x, int y) { switch (key) { case 27: //Escape key exit(0); } } void reshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, w, h, 0); glMatrixMode(GL_MODELVIEW); } void mouse_move1(int x, int y) { m_x = x; m_y = y; display1(); } void mouse1(int button, int state, int x, int y) { m_x = x; m_y = y; switch (button) { case GLUT_RIGHT_BUTTON: if (state == GLUT_DOWN) { // glutIdleFunc(spinDisplay); } if (state == GLUT_UP) { if (poi_size>0) { poi_size-=2; } rubber_band_on = 0; glutIdleFunc(NULL); } break; case GLUT_LEFT_BUTTON: rubber_band_on = 1; if (state == GLUT_DOWN) { down_flag = 1; } if (state == GLUT_UP) { if(down_flag) { poi_arr[poi_size][0]=x; poi_arr[poi_size][1]=y; poi_size++; down_flag = 0; } glutIdleFunc(NULL); } break; default: break; } display1(); } float calculate_radius(int x1,int y1) { int x_diff = m_x - x1; int y_diff = m_y - y1; if(x_diff<0) { x_diff *= -1; } if(y_diff<0) { y_diff *= -1; } float mag = x_diff*x_diff + y_diff*y_diff; float rad = sqrt(mag); return rad; } void display2(void) { glClear(GL_COLOR_BUFFER_BIT); for(int i=0; i<poi_size; i+=2) { int rad_index = (int)(i/2); float rad = rad_arr[rad_index]; if (rad>1) { drawCircle(rad,poi_arr[i][0],poi_arr[i][1]); } } glutSwapBuffers(); } void mouse_move2(int x, int y) { m_x = x; m_y = y; if (rubber_band_on) { float rd = calculate_radius(poi_arr[poi_size-1][0],poi_arr[poi_size-1][1]); rad_arr[poi_size/2] = rd; } display2(); } void mouse2(int button, int state, int x, int y) { m_x = x; m_y = y; switch (button) { case GLUT_RIGHT_BUTTON: if (state == GLUT_DOWN) { // glutIdleFunc(spinDisplay); } if (state == GLUT_UP) { glutIdleFunc(NULL); } break; case GLUT_LEFT_BUTTON: if (state == GLUT_DOWN) { down_flag = 1; } if (state == GLUT_UP) { if(down_flag) { poi_arr[poi_size][0]=x; poi_arr[poi_size][1]=y; poi_size++; down_flag = 0; rubber_band_on = !rubber_band_on; } glutIdleFunc(NULL); } break; default: break; } if (rubber_band_on && poi_size>0) { float rd = calculate_radius(poi_arr[poi_size-1][0],poi_arr[poi_size-1][1]); rad_arr[poi_size/2] = rd; } display2(); } int main(int argc, char **argv) { glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize(1000, 800); glutCreateWindow("OPENGL LINE DRAWING"); glClearColor(0.0, 0.0, 0.0, 1.0); menu(); if (t=1) { glutDisplayFunc(display1); glutReshapeFunc(reshape); glutIdleFunc(tick); glutKeyboardFunc(handleKeypress); glutMouseFunc(mouse1); glutMotionFunc(mouse_move1); glutPassiveMotionFunc(mouse_move1); glutMainLoop(); } if (t=2) { glutDisplayFunc(display2); glutReshapeFunc(reshape); glutIdleFunc(tick); glutKeyboardFunc(handleKeypress); glutMouseFunc(mouse2); glutMotionFunc(mouse_move2); glutPassiveMotionFunc(mouse_move2); glutMainLoop(); } return 0; /* ANSI C requires main to return int. */ }

Jun 22, 2013 | Advanced Graphics Programming Using OpenGL...

See all Advanced Graphics Programming Using OpenGL Questions

Advanced Graphics Programming Using OpenGL  Logo

Related Topics:

885 people viewed this question

Ask a Question

Usually answered in minutes!

Top Advanced Graphics Computers & Internet Experts

Doctor PC
Doctor PC

Level 3 Expert

7733 Answers

kakima

Level 3 Expert

102366 Answers

David Payne
David Payne

Level 3 Expert

14161 Answers

Are you an Advanced Graphics Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...