C++

57K

Solutions

24K

Contributors

C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.

Share tech news, updates, or what's on your mind.

Sign up to Post

This question is for Visual C++ MFC application in Visual Studio Community 2015 under Windiws 7.

When you set some text in multi line CEdit box in OnInitDialog function, that is called to initialize dialog's controls. the text is displayed as selected (highlighted.) No manipulations with CEdit interface in OnInitDialog can't remove this highlighting (Like using SetSel(-1,0).)  
Somebody knows how to initialize CEdit with no selection?
0
So I would like to make this program read a user inputted matrix instead of the one that is provided in the main function. Also, the limit to the 2d matrix should be more than 9, but no more than about 100 and should also be user defined.

The main function purpose that I had in mind would be something like:
int main(){
    int graph[V][V];
  printf("Enter number of towns: ");
  scanf("%d", V);
  printf("Enter distance matrix");
  scanf("%d", graph[V][V]);
  dijkstra(graph, 0);
return 0;}

Open in new window

which is giving me a great headache trying to write.. Any help would be greatly appreciated. Thank you.


// A C / C++ program for Dijkstra's single source shortest path algorithm.
// The program is for adjacency matrix representation of the graph
  
#include <stdio.h>
#include <limits.h>
  
// Number of vertices in the graph
#define V 9
  
// A utility function to find the vertex with minimum distance value, from
// the set of vertices not yet included in shortest path tree
int minDistance(int dist[], bool sptSet[])
{
   // Initialize min value
   int min = INT_MAX, min_index;
  
   for (int v = 0; v < V; v++)
     if (sptSet[v] == false && dist[v] <= min)
         min = dist[v], min_index = v;
  
   return min_index;
}
  
// A utility function to print the constructed distance array
int printSolution(int dist[], int n)
{
   printf("Vertex   Distance from Source\n");
   for (int i = 0; i < V; i++)
      printf("%d \t\t %d\n", i, dist[i]);
}
  
// Funtion that 

Open in new window

0
Mohon bantuan nya
0
Hi

I have a .txt file contains two cols .

number and state e.g :

number state

378     close
408      close
509      close

and I have another file contains numbers and corresponding values e.g:

number    value
1               0.345
2               0.234
3               0.236
. .
. .
15832

I done the first part which is to search for the numbers from the first file in the second file . for example search for (372,408 and so on ) in the second file , and if found take 13 numbers ( 6 before the number and 6 after ) together with their values from the second file  example ,

380 is in the first file ,  the program found 382 in the second file so it will take 13 number and value

380 found in the second file :

      374     0.681042
      375     0.69153
      376     0.702018
      377     0.712506
      378     0.722994
      379     0.733482
      380     0.74397
      381     0.754458
      382     0.764946
      383     0.775434
      384     0.785922
      385     0.79641
        386     0.74541

what I want now is to  to output the numbers that is doesn't

have match from file1.txt to file2.txt same way (6 before and 6 after ) .

for example the number ( 800 ) file2.txt doesn't have match file1.txt )  . I have attached file1, file2 and code .

        794   0.681042
        795     0.681042
      796     0.69153
      797     0.702018
      798     0.712506
      799     0.722994
      800    0.733482
      380     0.74397
      801     0.754458
      802    0.764946
      803     0.775434
      804     0.785922
0

C++

57K

Solutions

24K

Contributors

C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.