Jump to content

Who can help me to change into Pseudocode?


Newbie89
 Share

Recommended Posts

Here is the code... 1 #include <stdio.h> 2 #include <sqlite3.h> 3 4 int main(void) { 5 sqlite3 *conn; 6 sqlite3_stmt *res; 7 int error = 0; 8 int rec_count = 0; 9 const char *errMSG; 10 const char *tail; 11 12 error = sqlite3_open("ljdata.sl3", &conn); 13 if (error) { 14 puts("Can not open database"); 15 exit(0); 16 } 17 18 error = sqlite3_exec(conn, 19 "update people set phonenumber=\'5055559999\' where id=3", 20 0, 0, 0); 21 22 error = sqlite3_prepare_v2(conn, 23 "select lastname,firstname,phonenumber,id from people order by id", 24 1000, &res, &tail); 25 26 if (error != SQLITE_OK) { 27 puts("We did not get any data!"); 28 exit(0); 29 } 30 31 puts("=========================="); 32 33 while (sqlite3_step(res) == SQLITE_ROW) { 34 printf("%s|", sqlite3_column_text(res, 0)); 35 printf("%s|", sqlite3_column_text(res, 1)); 36 printf("%s|", sqlite3_column_text(res, 2)); 37 printf("%u\n", sqlite3_column_int(res, 3)); 38 39 rec_count++; 40 } 41 42 puts("=========================="); 43 printf("We received %d records.\n", rec_count); 44 45 sqlite3_finalize(res); 46 47 sqlite3_close(conn); 48 49 return 0; 50 }

Link to comment
Share on other sites

That's kind of a weird question, but this is what I would make of it:

declare variables; open connection to sqlite;if there was an error:  print error message and quit;end if; execute update query; execute select query and get result;if there was an error:  print error message and quit;end if; print divider; while there is a record in the result:  print column 0;  print column 1;  print column 2;  print column 3;  increment record counter;end while; print divider;print record counter; finalize result;close sqlite connection;

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...